void _lucEigenvectorsCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data )
{
   lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;

   /* Construct Parent */
   self->defaultResolution = 8;  /* Default sampling res */
   _lucCrossSection_AssignFromXML( self, cf, data );
   self->gatherData = False;     /* Drawn in parallel */
   strcpy(self->fieldVariableName, "TensorField");

   _lucEigenvectorsCrossSection_Init(
      self,
      Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 2  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColour", "black"  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColour", "black"  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColour", "black"  ),
      Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3  ),
      Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 1.0  ),
      Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"glyphs", 3),
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useEigenValue", True  ),
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenVector", True  ),
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenValue", False  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColourForNegative", "black"  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColourForNegative", "black"  ),
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black" ) );
}
void _RefinedRegionsGeometry_Construct( void* refinedRegionsGeometry, Stg_ComponentFactory *cf, void* data ) {
    RefinedRegionsGeometry*  self   = (RefinedRegionsGeometry*)refinedRegionsGeometry;
    IJK             size;
    int             shift;
    Dimension_Index dim;
    Dimension_Index dim_I;

    self->dictionary =  Dictionary_GetDictionary( cf->componentDict, self->name );

    /* Get Size from Dictionary */
    dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, "dim", 0 );

    size[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "sizeI", 1 );
    size[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "sizeJ", 1 );
    size[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "sizeK", 1 );
    if ( dim == 2 )
        size[ K_AXIS ] = 1;

    /* Shift the size if nessesary */
    shift = Stg_ComponentFactory_GetInt( cf, self->name, "sizeShift", 0 );
    for ( dim_I = I_AXIS ; dim_I < dim ; dim_I++ )
        size[ dim_I ] += shift;

    _Geometry_Init( (Geometry*)self );
    _RefinedRegionsGeometry_Init( self, size );
}
void _EscapedRoutine_AssignFromXML( void* escapedRoutine, Stg_ComponentFactory* cf, void* data ) {
	EscapedRoutine*	self = (EscapedRoutine*) escapedRoutine;
	Dimension_Index	dim;
	Particle_Index		particlesToRemoveDelta;

	dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0  );
	particlesToRemoveDelta = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"particlesToRemoveDelta", 20  );

	_EscapedRoutine_Init( self, dim, particlesToRemoveDelta );
}
void _TriSingleCellLayout_AssignFromXML( void *triSingleCellLayout, Stg_ComponentFactory *cf, void* data ){
	TriSingleCellLayout	*self = (TriSingleCellLayout*)triSingleCellLayout;
	Dimension_Index		dim = 0;

	_CellLayout_AssignFromXML( self, cf, data );

	dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0 );
	assert( dim );

	_TriSingleCellLayout_Init( (TriSingleCellLayout* )self, cf->rootDict, dim );
}
void _ForceVector_AssignFromXML( void* forceVector, Stg_ComponentFactory* cf, void* data ) {
	ForceVector*    self = (ForceVector*)forceVector;
	Dimension_Index dim = 0;
	void*           entryPointRegister = NULL;

	_SolutionVector_AssignFromXML( self, cf, data );
	
	dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0 );

	entryPointRegister = (void*)self->context->entryPoint_Register;
	assert( entryPointRegister  );
	
	_ForceVector_Init( self, dim, entryPointRegister );
}
Example #6
0
void _SingleCellLayout_Construct( void* singleCellLayout, Stg_ComponentFactory* cf, void* data ){
	SingleCellLayout* self              = (SingleCellLayout*)singleCellLayout;
	Bool              dimExists[]       = { False, False, False };
	Dimension_Index   dim;
	XYZ               min;
	XYZ               max;

	dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, "dim", 0 );

	dimExists[ I_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsI", True );
	dimExists[ J_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsJ", True );
	dimExists[ K_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsK", (dim == 3) );

	min[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minX", -1.0 );
	min[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minY", -1.0 );
	min[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minZ", -1.0 );

	max[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxX", 1.0 );
	max[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxY", 1.0 );
	max[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxZ", 1.0 );

	_CellLayout_Init( (CellLayout*)self );
	_SingleCellLayout_Init( self, dimExists, min, max );
}
void _FieldVariable_AssignFromXML( void* fieldVariable, Stg_ComponentFactory* cf, void* data ) {
   FieldVariable*          self = (FieldVariable*)fieldVariable;
   FieldVariable_Register* fV_Register=NULL;
   Dimension_Index         dim;
   Index                   fieldComponentCount;
   Bool                    isCheckpointedAndReloaded, isCheckpointedAndReloaded2;
   Dictionary_Entry_Value* feVarsList = NULL;
   char*                   o_units = NULL;
   DomainContext*          context;
   Bool                    useCacheMaxMin;

   context = Stg_ComponentFactory_ConstructByKey(
      cf,
      self->name,
      (Dictionary_Entry_Key)"Context",
      DomainContext,
      False,
      data );

   if( !context )
      context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, False, data );
   
   if (context) {
      fV_Register = context->fieldVariable_Register;
      assert( fV_Register );
   }

   dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0 );
   /* allow this to be overwritten by the component dub dict */
   dim = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"dim", dim );

   fieldComponentCount = Stg_ComponentFactory_GetUnsignedInt(
      cf,
      self->name,
      (Dictionary_Entry_Key)"fieldComponentCount",
      0 );

   useCacheMaxMin = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useCacheMaxMin", False );
   
   o_units = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"outputUnits", NULL );

   /* 
    * Decide whether this FieldVariable will be checkpointed & reloaded, based on the dictionary list 
    * "fieldVariableToCheckpoint". NB may want to put this in the XML component definintion of a
    * FieldVariable itself, but for now prefer list so it can be centrally set.
    * -- Pat, Jules, Kath - 29 November 2006 
    */

   isCheckpointedAndReloaded2 = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"isCheckpointedAndReloaded", False );

   /* Case insensitive search */
   feVarsList = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)"fieldVariablesToCheckpoint" );
   if( NULL == feVarsList ) {
      feVarsList = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)"FieldVariablesToCheckpoint" );
   }

   if( feVarsList != NULL ) {
      Index                   listLength = Dictionary_Entry_Value_GetCount( feVarsList );
      Index                   var_I = 0;
      Dictionary_Entry_Value* feVarDictValue = NULL;
      char*                   fieldVariableName;
   
      /* if the 'fieldVariablesToCheckpoint' list is empty (but exists)
       *    checkpoint every field
       * else selectively checkpoint based on list entries */
      if( listLength == 0 ) { 
         isCheckpointedAndReloaded = True; 
      }
      else {
         isCheckpointedAndReloaded = False;
         for ( var_I = 0; var_I < listLength; var_I++  ) {
            feVarDictValue = Dictionary_Entry_Value_GetElement( feVarsList, var_I );
            fieldVariableName = Dictionary_Entry_Value_AsString( feVarDictValue ); 
            if ( 0 == strcmp( self->name, fieldVariableName ) ) {
               isCheckpointedAndReloaded = True;
               break;
            }
         }
      }
   }
   else {
      /* If there's no special list, just checkpoint/reload everything. */
      isCheckpointedAndReloaded = True;
   }

   isCheckpointedAndReloaded = (isCheckpointedAndReloaded || isCheckpointedAndReloaded2 );

   feVarsList = NULL;
   /* also include check to see if this fevariable should be saved for analysis purposes */ 
   feVarsList = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)"fieldVariablesToSave" );

   if( NULL == feVarsList ) {
      feVarsList = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)"FieldVariablesToSave" );
   }
   if( feVarsList != NULL ) {
      Index                   listLength = Dictionary_Entry_Value_GetCount( feVarsList );
      Index                   var_I = 0;
      Dictionary_Entry_Value* feVarDictValue = NULL;
      char*                   fieldVariableName;
   
      for( var_I = 0; var_I < listLength; var_I++ ) {
         feVarDictValue = Dictionary_Entry_Value_GetElement( feVarsList, var_I );
         fieldVariableName = Dictionary_Entry_Value_AsString( feVarDictValue ); 

         if( 0 == strcmp( self->name, fieldVariableName ) ) {
            self->isSavedData = True;
            break;
         }
      }
   }
   _FieldVariable_Init(
      self,
      context,
      fieldComponentCount,
      dim,
      isCheckpointedAndReloaded,
      o_units,
      MPI_COMM_WORLD,
      fV_Register,
      useCacheMaxMin );

}