MFNRegion MFNRegionCreateForcedOscillator(int n, int WN,double eMin,double eMax, double BMin,double BMax, MFErrorHandler e)
 {
  static char RoutineName[]={"MFNRegionCreateForcedOscillator"};
  MFNRegion Omega;
  double *data;

  Omega=MFNRegionCreateBaseClass("ForcedOscillator",e);
  MFNRegionSetTest(Omega,ForcedOscillatorTest,e);
  MFNRegionSetFreeData(Omega,ForcedOscillatorFree,e);

  data=(double*)malloc(4*sizeof(double));
#ifndef MFNPOSAFETYNET
  if(data==NULL)
   {
    sprintf(MFForcedNRegionMFErrorHandlerMsg,"Out of memory, trying to allocate %d bytes",4*sizeof(double));
    MFSetError(e,12,RoutineName,MFForcedNRegionMFErrorHandlerMsg,__LINE__,__FILE__);
    MFErrorHandlerOutOfMemory(e);
    free(Omega);
    return NULL;
   }
#endif

  data[0]=eMin;
  data[1]=eMax;
  data[2]=BMax;
  data[3]=BMin;

  MFNRegionSetData(Omega,data,e);

  return(Omega);
 }
Example #2
0
MFNRegion MFNRegionCreateLOCA(LOCAData* data)
{
  MFNRegion loca;

  loca=MFNRegionCreateBaseClass("LOCA", data->mfErrorHandler);
  MFNRegionSetTest(loca,LOCATest, data->mfErrorHandler);
  MFNRegionSetData(loca,(void *)data, data->mfErrorHandler);
  MFNRegionSetFreeData(loca,MFFreeLOCAData, data->mfErrorHandler);

  return(loca);
}
Example #3
0
MFNRegion MFNRegionCreateAUTO(MFNSpace space, int k, long *icp, double *RL0, double *RL1, double A0,double A1, MFErrorHandler e)
 {
  static char RoutineName[]={"MFNRegionCreateAUTO"};
  MFNRegion Auto;
  struct MFAUTONRegionData *data;
  int i;

  Auto=MFNRegionCreateBaseClass("AUTO",e);
  MFNRegionSetTest(Auto,MFAUTONSpaceTest,e);
  data=malloc(sizeof(struct MFAUTONRegionData));

#ifndef MFNOSAFETYNET
  if(data==NULL)
   {
    sprintf(MFAUTONRegionErrorMsg,"Out of memory, trying to allocate %d bytes",sizeof(struct MFAUTONRegionData));
    MFSetError(e,12,RoutineName,MFAUTONRegionErrorMsg,__LINE__,__FILE__);
    MFErrorHandlerOutOfMemory(e);
    return NULL;
   }
#endif

  MFNRegionSetData(Auto,data,e);
  MFNRegionSetFreeData(Auto,MFAUTONRegionFreeData,e);
  MFRefNSpace(space,e);

  data->space=space;
  data->k=k;
  data->icp=icp;
  data->RL0=malloc(k*sizeof(double));

#ifndef MFNOSAFETYNET
  if(data->RL0==NULL)
   {
    sprintf(MFAUTONRegionErrorMsg,"Out of memory, trying to allocate %d bytes",k*sizeof(double));
    MFSetError(e,12,RoutineName,MFAUTONRegionErrorMsg,__LINE__,__FILE__);
    MFErrorHandlerOutOfMemory(e);
    return NULL;
   }
#endif

  for(i=0;i<k;i++)(data->RL0)[i]=RL0[i];

  data->RL1=malloc(k*sizeof(double));

#ifndef MFNOSAFETYNET
  if(data->RL1==NULL)
   {
    sprintf(MFAUTONRegionErrorMsg,"Out of memory, trying to allocate %d bytes",k*sizeof(double));
    MFSetError(e,12,RoutineName,MFAUTONRegionErrorMsg,__LINE__,__FILE__);
    MFErrorHandlerOutOfMemory(e);
    return NULL;
   }
#endif

  for(i=0;i<k;i++)(data->RL1)[i]=RL1[i];

  data->A0=A0;
  data->A1=A1;

  return(Auto);
 }