当前位置: 首页>>代码示例>>C++>>正文


C++ LALFree函数代码示例

本文整理汇总了C++中LALFree函数的典型用法代码示例。如果您正苦于以下问题:C++ LALFree函数的具体用法?C++ LALFree怎么用?C++ LALFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LALFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: destroyCoherentGW

static void destroyCoherentGW( CoherentGW *waveform )
{
  if ( waveform->h )
  {
    XLALDestroyREAL4VectorSequence( waveform->h->data );
    LALFree( waveform->a );
  }
  if ( waveform->a )
  {
    XLALDestroyREAL4VectorSequence( waveform->a->data );
    LALFree( waveform->a );
  }
  if ( waveform->phi )
  {
    XLALDestroyREAL8Vector( waveform->phi->data );
    LALFree( waveform->phi );
  }
  if ( waveform->f )
  {
    XLALDestroyREAL4Vector( waveform->f->data );
    LALFree( waveform->f );
  }
  if ( waveform->shift )
  {
    XLALDestroyREAL4Vector( waveform->shift->data );
    LALFree( waveform->shift );
  }

  return;
}
开发者ID:benjaminlackey,项目名称:lalsuitedissipation,代码行数:30,代码来源:calcexpsnr.c

示例2: eos_free_piecewise_polytrope

static void eos_free_piecewise_polytrope(LALSimNeutronStarEOS * eos)
{
    if (eos) {
        LALFree(eos->data.piecewisePolytrope);
        LALFree(eos);
    }
}
开发者ID:lpsinger,项目名称:lalsuite,代码行数:7,代码来源:LALSimNeutronStarEOSPiecewisePolytrope.c

示例3: Freemem

int Freemem(void)
{

  LALFree(po);
  LALFree(p);

  LALCheckMemoryLeaks();
  
  return 0;
}
开发者ID:smirshekari,项目名称:lalsuite,代码行数:10,代码来源:psd.c

示例4: XLALDestroyDetectorStateSeries

/** Get rid of a DetectorStateSeries */
void
XLALDestroyDetectorStateSeries ( DetectorStateSeries *detStates )
{
  if ( !detStates )
    return;

  if ( detStates->data ) LALFree ( detStates->data );
  LALFree ( detStates );

  return;

} /* XLALDestroyDetectorStateSeries() */
开发者ID:johnveitch,项目名称:lalsuite,代码行数:13,代码来源:DetectorStates.c

示例5: fstat_cpt_file_create

/* sets up a FstatCheckpointFile from parameters */
int fstat_cpt_file_create (FstatCheckpointFile **cptf,
			   CHAR  *filename,
			   UINT4 bufsize,
			   UINT4 maxsize,
			   toplist_t*list) {

  /* input sanity checks */
  if ( (cptf == NULL) ||
       (*cptf != NULL) ||
       (list == NULL) ||
       (filename == NULL) ||
       (strlen (filename) == 0) ) {
    LogPrintf (LOG_CRITICAL, "ERROR: error in input parameters (fstat_cpt_file_create)\n");
    return(-1);
  }

  /* allocation */
  *cptf = LALMalloc(sizeof(FstatCheckpointFile));
  if (!(*cptf)) {
    LogPrintf (LOG_CRITICAL, "ERROR: out of memeory (fstat_cpt_file_create)\n");
    return(-1);
  }

  (*cptf)->filename = LALMalloc(strlen(filename)+1);
  if (!((*cptf)->filename)) {
    LogPrintf (LOG_CRITICAL, "ERROR: out of memeory (fstat_cpt_file_create)\n");
    LALFree(*cptf);
    *cptf = NULL;
    return(-1);
  }

  if (bufsize > 0) {
    (*cptf)->buffer = LALMalloc(bufsize);
    if (!((*cptf)->buffer)) {
      LogPrintf (LOG_CRITICAL, "ERROR: out of memeory (fstat_cpt_file_create)\n");
      LALFree(*cptf);
      LALFree((*cptf)->filename);
      *cptf = NULL;
      return(-1);
    }
  }

  /* initialization */
  strncpy((*cptf)->filename,filename,strlen(filename)+1);

  (*cptf)->bytes = 0;
  (*cptf)->bufsize = bufsize;
  (*cptf)->maxsize = maxsize;
  (*cptf)->checksum = 0;
  (*cptf)->fp = NULL;
  (*cptf)->list = list;
  return(0);
}
开发者ID:Solaro,项目名称:lalsuite,代码行数:54,代码来源:FstatToplist.c

示例6: fstat_cpt_file_destroy

/* destroys a FstatCheckpointFile structure */
int fstat_cpt_file_destroy (FstatCheckpointFile **cptf) {
  if (!cptf) {
    LogPrintf (LOG_CRITICAL, "ERROR: FstatCheckpointFile is NULL\n");
    return(-1);
  }
  if((*cptf)->filename)
    LALFree((*cptf)->filename);
  if((*cptf)->buffer)
    LALFree((*cptf)->buffer);
  LALFree(*cptf);
  *cptf = NULL;
  return(0);
}
开发者ID:Solaro,项目名称:lalsuite,代码行数:14,代码来源:FstatToplist.c

示例7: FreeMem

int FreeMem(void)
{
	if (SSparams->numSpinDown>0) {
	  for(i=0;i<SSparams->numSTKs;i++) {
     		LALFree(pTdotsAndDeltaTs->vecDeltaTs[i]);          
                                            }
  	  LALFree(pTdotsAndDeltaTs->vecDeltaTs);
	                              }
  	LALFree(pTdotsAndDeltaTs->vecTDots);
        LALFree(pTdotsAndDeltaTs);
	
	

	for (i=0; i<7 ; i++)
               {
	          LALFree(fakeSFT[i]);
               }
        LALFree(fakeSFT);
		
        LALFree(SSparams);
    
	LALFree(params);
        
	
return 0;

}
开发者ID:smirshekari,项目名称:lalsuite,代码行数:27,代码来源:StackSlideBinaryTest.c

示例8: XFUNC

ATYPE * XFUNC ( UINT4Vector *dimLength )
{
  ATYPE *arr;
  UINT4 size = 1;
  UINT4 ndim;
  UINT4 dim;

  if ( ! dimLength )
    XLAL_ERROR_NULL( XLAL_EFAULT );
  if ( ! dimLength->length )
    XLAL_ERROR_NULL( XLAL_EBADLEN );
  if ( ! dimLength->data )
    XLAL_ERROR_NULL( XLAL_EINVAL );

  ndim = dimLength->length;
  for ( dim = 0; dim < ndim; ++dim )
    size *= dimLength->data[dim];

  if ( ! size )
    XLAL_ERROR_NULL( XLAL_EBADLEN );

  /* create array */
  arr = LALMalloc( sizeof( *arr ) );
  if ( ! arr )
    XLAL_ERROR_NULL( XLAL_ENOMEM );

  /* create array dimensions */
  arr->dimLength = XLALCreateUINT4Vector( ndim );
  if ( ! arr->dimLength )
  {
    LALFree( arr );
    XLAL_ERROR_NULL( XLAL_EFUNC );
  }

  /* copy dimension lengths */
  memcpy( arr->dimLength->data, dimLength->data,
      ndim * sizeof( *arr->dimLength->data ) );

  /* allocate data storage */
  arr->data = LALMalloc( size * sizeof( *arr->data ) );
  if ( ! arr->data )
  {
    XLALDestroyUINT4Vector( arr->dimLength );
    LALFree( arr );
    XLAL_ERROR_NULL( XLAL_ENOMEM );
  }

  return arr;
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:49,代码来源:CreateArray_source.c

示例9: LALDriveNRInject

/** Main driver funtion for doing Numerical Relativity Injections */
void LALDriveNRInject( LALStatus *status,	/**< pointer to LALStatus structure */
		       REAL4TimeSeries *injData, /**< The time series to inject into */
		       SimInspiralTable *injections, /**< The list of injections to perform */
		       NumRelInjectParams *params /**< Parameters */
		       )
{

  REAL4TimeVectorSeries *sumStrain = NULL;
  SimInspiralTable *thisInj    = NULL;   /* current injection */

  INITSTATUS(status);
  ATTATCHSTATUSPTR (status);

  /* loop over injections */
  for ( thisInj = injections; thisInj; thisInj = thisInj->next )
    {

      TRY( LALAddStrainModes(status->statusPtr, &sumStrain, params->nrCatalog,
				  params->modeLlo, params->modeLhi, thisInj), status);

      TRY( LALInjectStrainGW( status->statusPtr, injData, sumStrain, thisInj, params->ifo, params->dynRange), status);

      XLALDestroyREAL4VectorSequence ( sumStrain->data );
      LALFree( sumStrain );
      sumStrain = NULL;

    } /* end loop over injections */


  DETATCHSTATUSPTR(status);
  RETURN(status);

}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:34,代码来源:NRWaveIO.c

示例10: XFUNC

STYPE * XFUNC ( UINT4 length, UINT4 veclen )
{
  STYPE *seq;

  if ( ! length || ! veclen )
    XLAL_ERROR_NULL( XLAL_EBADLEN );

  seq = LALMalloc( sizeof( *seq ) );
  if ( ! seq )
    XLAL_ERROR_NULL( XLAL_ENOMEM );

  seq->length = length;
  seq->vectorLength = veclen;

  if ( ! length || ! veclen )
    seq->data = NULL;
  else
  {
    seq->data = LALMalloc( length * veclen * sizeof( *seq->data ) );
    if ( ! seq )
    {
      LALFree( seq );
      XLAL_ERROR_NULL( XLAL_ENOMEM );
    }
  }

  return seq;
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:28,代码来源:CreateVectorSequence_source.c

示例11: calculate_ligo_snr_from_strain

REAL8 calculate_ligo_snr_from_strain(  REAL4TimeVectorSeries *strain,
                                       SimInspiralTable      *thisInj,
                                       const CHAR            ifo[3])
{

  REAL8 ret = -1, snrSq, freq, psdValue;
  REAL8 sampleRate = 4096, deltaF;
  REAL4TimeSeries *chan = NULL;
  REAL4FFTPlan *pfwd;
  COMPLEX8FrequencySeries *fftData;
  UINT4 k;

  /* create the time series */
  chan    = XLALCalculateNRStrain( strain, thisInj, ifo, sampleRate );
  deltaF  = chan->deltaT * strain->data->vectorLength;
  fftData = XLALCreateCOMPLEX8FrequencySeries( chan->name,  &(chan->epoch),
                                               0, deltaF, &lalDimensionlessUnit,
                                               chan->data->length/2 + 1 );

  /* perform the fft */
  pfwd = XLALCreateForwardREAL4FFTPlan( chan->data->length, 0 );
  XLALREAL4TimeFreqFFT( fftData, chan, pfwd );

  /* compute the SNR for initial LIGO at design */
  for ( snrSq = 0, k = 0; k < fftData->data->length; k++ )
    {
      freq = fftData->deltaF * k;

      if ( ifo[0] == 'V' )
        {
          if (freq < 35)
            continue;

          LALVIRGOPsd( NULL, &psdValue, freq );
          psdValue /= 9e-46;
        }
      else
        {
          if (freq < 40)
            continue;

          LALLIGOIPsd( NULL, &psdValue, freq );
        }

      fftData->data->data[k] /= 3e-23;
      snrSq += crealf(fftData->data->data[k]) * crealf(fftData->data->data[k]) / psdValue;
      snrSq += cimagf(fftData->data->data[k]) * cimagf(fftData->data->data[k]) / psdValue;
    }

  snrSq *= 4*fftData->deltaF;

  XLALDestroyREAL4FFTPlan( pfwd );
  XLALDestroyCOMPLEX8FrequencySeries( fftData );

  XLALDestroyREAL4Vector ( chan->data);
  LALFree(chan);

  ret = sqrt(snrSq);
  return ret;
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:60,代码来源:inspiralutils.c

示例12: XLALREAL8VectorListAddEntry

static REAL8VectorList *
XLALREAL8VectorListAddEntry (REAL8VectorList *head, const REAL8Vector *entry)
{
  UINT4 dim;
  REAL8VectorList *ptr = NULL;  /* running list-pointer */
  REAL8VectorList *newElement = NULL;   /* new list-element */
  /* check illegal input */
  if ( (head == NULL) || (entry == NULL) )
    return NULL;

  /* find tail of list */
  ptr = head;
  while ( ptr->next )
    ptr = ptr->next;

  /* construct new list-element */
  dim = entry->length;
  if ( (newElement = LALCalloc (1, sizeof (*newElement))) == NULL)
    return NULL;
  if ( (newElement->entry.data = LALCalloc (dim, sizeof(entry->data[0]))) == NULL ) {
    LALFree (newElement);
    return NULL;
  }
  newElement->entry.length = dim;
  memcpy (newElement->entry.data, entry->data, dim * sizeof(entry->data[0]) );

  /* link this to the tail of list */
  ptr->next = newElement;
  newElement->prev = ptr;

  return newElement;

} /* XLALREAL8VectorListAddEntry() */
开发者ID:llondon6,项目名称:lalsuite-mmrd,代码行数:33,代码来源:DopplerFullScan.c

示例13: FUNC

void FUNC ( LALStatus *status, STYPE **aseq )
{
  /*
   * Initialize status
   */

  INITSTATUS(status);
  ATTATCHSTATUSPTR( status );

  /*
   * Check aseq: is it non-NULL?
   */

  ASSERT (aseq != NULL, status, SEQFACTORIESH_EVPTR, SEQFACTORIESH_MSGEVPTR);

  /*
   * Check aseq: does it point to non-NULL?
   */

  ASSERT (*aseq != NULL,status, SEQFACTORIESH_EUPTR, SEQFACTORIESH_MSGEUPTR);

  /*
   * Check dimLength in aseq: does it point to non-NULL?
   */

  ASSERT ((*aseq)->dimLength != NULL, status,
          SEQFACTORIESH_EDPTR, SEQFACTORIESH_MSGEDPTR);

  /*
   * Check data in aseq: does it point to non-NULL?
   */

  ASSERT ((*aseq)->data != NULL, status,
          SEQFACTORIESH_EDPTR, SEQFACTORIESH_MSGEDPTR);

  /* Ok, now let's free allocated storage */

  TRY( LALU4DestroyVector( status->statusPtr, &((*aseq)->dimLength) ),
       status );
  LALFree ( (*aseq)->data ); /* free allocated data */
  LALFree ( *aseq );	      /* free aseq struct itself */

  *aseq = NULL;		/* make sure we don't point to freed struct */

  DETATCHSTATUSPTR( status );
  RETURN (status);
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:47,代码来源:DestroyArraySequence_source.c

示例14: testPadding

/* test to make sure padding does what it's supposed to do */
static int testPadding( void )
{
  int keep = lalDebugLevel;

  XLALClobberDebugLevel(lalDebugLevel | LALMEMDBGBIT | LALMEMPADBIT);
  XLALClobberDebugLevel(lalDebugLevel & ~LALMEMTRKBIT);

  /* try to free NULL pointer */
  /* changed behaviour: LALFree is a no-op when passed NULL */
  // trial( LALFree( NULL ), SIGSEGV, "error: tried to free NULL pointer" );

  /* double free */
  /* actually, this cannot be done robustly -- system can change values
   * in unallocated space at will */
  //trial( p = LALMalloc( 2 * sizeof( *p ) ), 0, "" );
  //trial( LALFree( p ), 0, "" );
  //trial( LALFree( p ), SIGSEGV, "error: tried to free a freed pointer" );
  //trial( LALCheckMemoryLeaks(), 0, "" );

  /* wrong magic */
  trial( p = LALMalloc( 2 * sizeof( *p ) ), 0, "" );
  p[-1] = 4;
  trial( LALFree( p ), SIGSEGV, "error: wrong magic" );
  p[-1] = 0xABadCafe;
  trial( LALFree( p ), 0, "" );
  trial( LALCheckMemoryLeaks(), 0, "" );

  /* corrupt size */
  trial( p = LALMalloc( 4 * sizeof( *p ) ), 0, "");
  n = p[-2];
  p[-2] = -2;
  trial( LALFree( p ), SIGSEGV, "error: corrupt size descriptor" );
  p[-2] = n;
  trial( LALFree( p ), 0, "" );
  trial( LALCheckMemoryLeaks(), 0, "" );

  /* overwritten array bounds */
  trial( p = LALMalloc( 8 * sizeof( *p ) ), 0, "" );
  n = p[8];
  p[8] = 0;
  trial( LALFree( p ), SIGSEGV, "error: array bounds overwritten" );
  p[8] = n;
  trial( LALFree( p ), 0, "" );
  trial( LALCheckMemoryLeaks(), 0, "" );

  /* free too much memory */
  q = malloc( 4 * sizeof( *p ) );
  trial( p = LALMalloc( sizeof( *p ) ), 0, "" );
  memcpy( q, p - 2, 4 * sizeof( *p ) );
  trial( LALFree( p ), 0, "" );
  trial( LALFree( q + 2 ), SIGSEGV, "error: lalMallocTotal too small" );
  free( q );
  trial( LALCheckMemoryLeaks(), 0, "" );

  XLALClobberDebugLevel(keep);
  return 0;
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:58,代码来源:LALMallocTest.c

示例15: LALRemoveKnownLinesInMultiSFTVector

/**
 * top level function to remove lines from a multi sft vector given a list of files
 * containing list of known spectral lines
 */
void LALRemoveKnownLinesInMultiSFTVector (LALStatus        *status,        /**< pointer to LALStatus structure */
					  MultiSFTVector   *MultiSFTVect,  /**< SFTVector to be cleaned */
					  INT4             width,          /**< maximum width to be cleaned */
					  INT4             window,         /**< window size for noise floor estimation in vicinity of a line */
					  LALStringVector *linefiles,      /**< file with list of lines */
					  RandomParams     *randPar)       /**< for creating random numbers */
{

  UINT4 k, j, numifos;
  CHAR *ifo;

  INITSTATUS(status);
  ATTATCHSTATUSPTR (status);


  ASSERT (MultiSFTVect, status, SFTCLEANH_ENULL, SFTCLEANH_MSGENULL);
  ASSERT (MultiSFTVect->data, status, SFTCLEANH_ENULL, SFTCLEANH_MSGENULL);
  ASSERT (MultiSFTVect->length > 0, status, SFTCLEANH_EVAL, SFTCLEANH_MSGEVAL);
  ASSERT (width > 0, status, SFTCLEANH_EVAL, SFTCLEANH_MSGEVAL);
  ASSERT (window > 0, status, SFTCLEANH_EVAL, SFTCLEANH_MSGEVAL);

  numifos = MultiSFTVect->length;

  if ( linefiles != NULL ) {

  ASSERT (linefiles->length > 0, status, SFTCLEANH_EVAL, SFTCLEANH_MSGEVAL);
  ASSERT (linefiles->data, status, SFTCLEANH_ENULL, SFTCLEANH_MSGENULL);

  /* loop over linefiles and clean the relevant SFTs */
  for ( k = 0; k < linefiles->length; k++)
    {
      ifo = NULL;
      /* try to get the ifo name from the linefile name */
      if ( (ifo = XLALGetChannelPrefix ( linefiles->data[k])) == NULL) {
        ABORT ( status, SFTCLEANH_ELINENAME, SFTCLEANH_MSGELINENAME);
      }

      /* loop over ifos and see if any matches */
      for ( j = 0; j < numifos; j++)
	{
	  if ( strncmp( ifo, MultiSFTVect->data[j]->data->name, 3) == 0) {
	    /* clean the sftvector which has matched */
	    TRY ( LALRemoveKnownLinesInSFTVect ( status->statusPtr, MultiSFTVect->data[j],
						 width, window, linefiles->data[k], randPar), status);
	  }

	} /* loop over ifos */

      LALFree( ifo );

    } /* loop over linefiles */

  } /* if linefiles != NULL */


  DETATCHSTATUSPTR (status);
  /* normal exit */
  RETURN (status);
}
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:63,代码来源:SFTClean.c


注:本文中的LALFree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。