void _SUPGAdvDiffTermPpc_AssignFromXML( void* residual, Stg_ComponentFactory* cf, void* data ) {
   SUPGAdvDiffTermPpc* self = (SUPGAdvDiffTermPpc*)residual;
   PpcManager*         mgr = NULL;

   /* Construct Parent */
   _ForceTerm_AssignFromXML( self, cf, data );

   /* The PpcManager */
   mgr = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Manager", PpcManager, False, data );

   if ( !mgr  )
      mgr = Stg_ComponentFactory_ConstructByName( cf, (Name)"default_ppcManager", PpcManager, True, data );

   _SUPGAdvDiffTermPpc_Init(
      self,
      mgr,
      Stg_ComponentFactory_ConstructByNameWithKeyFallback(
         cf,
         self->name,
         (Dictionary_Entry_Key)"default_EnergyEqn",
         (Dictionary_Entry_Key)"EnergyEqn",
         AdvectionDiffusionSLE, True, data ), 
      Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VelocityField", FeVariable, True, data ), 
      Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PhiField", FeVariable, True, data ), 
      Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"UpwindXiFunction", "Exact" ), 
      PpcManager_GetPpcFromDict( mgr, cf, self->name, (Dictionary_Entry_Key)"DiffusivityLabel", "DiffusivityLabel" ) );
}
void _Pouliquen_etal_AssignFromXML( void* pouliquen_etal, Stg_ComponentFactory* cf, void* data ){
	Pouliquen_etal*          self           = (Pouliquen_etal*)pouliquen_etal;
	FeVariable*             pressureField;
	FeVariable*             strainRateInvField;
	MaterialPointsSwarm*    materialPointsSwarm;

	/* Construct Parent */
	_VonMises_AssignFromXML( self, cf, data );
	
	pressureField      = (FeVariable *) 
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, True, data );
			
	strainRateInvField      = (FeVariable * ) 
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StrainRateInvariantField", FeVariable, True, data );

	materialPointsSwarm     = (MaterialPointsSwarm* )
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data  );
		
	_Pouliquen_etal_Init( self, 
			pressureField,
			strainRateInvField,
			materialPointsSwarm, 
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimumYieldStress", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficient", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficientAfterSoftening", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"grainDiameter", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"Io", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rho_s", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_2", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_s", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_2_afterSoftening", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_s_afterSoftening", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxViscosity", 0.0  ),
			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minViscosity", 0.0 )   );
}
void _MeshAdaptor_AssignFromXML( void* adaptor, Stg_ComponentFactory* cf, void* data ) {
	MeshAdaptor*	self = (MeshAdaptor*)adaptor;

	_MeshGenerator_AssignFromXML( self, cf, data );

	/* There could be either a generator or a mesh to use as a template.  Prefer the mesh. */
	self->srcMesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"sourceMesh", Mesh, False, data );
	if( !self->srcMesh  ) {
		/* Read the source generator. */
		self->generator = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"sourceGenerator", MeshGenerator, True, data  );
	}
}
void _SolutionVector_AssignFromXML( void* solutionVector, Stg_ComponentFactory* cf, void* data ) {
	SolutionVector*			self = (SolutionVector*)solutionVector;
	FeVariable*					feVariable = NULL;
	FiniteElementContext*	context;

	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", FiniteElementContext, False, data );
	if( !context  )
		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", FiniteElementContext, True, data  );

	feVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FeVariable", FeVariable, True, data  ) ;
	_SolutionVector_Init( self, context, MPI_COMM_WORLD, (FeVariable*)feVariable );
}
Exemple #5
0
void _MeshLayout_Construct( void* meshLayout, Stg_ComponentFactory *cf, void* data ){
	MeshLayout *self = (MeshLayout*)meshLayout;
	ElementLayout *elementLayout = NULL;
	NodeLayout *nodeLayout = NULL;
	MeshDecomp *meshDecomp = NULL;

	elementLayout =  Stg_ComponentFactory_ConstructByKey( cf, self->name, ElementLayout_Type, ElementLayout, True, data );
	nodeLayout =  Stg_ComponentFactory_ConstructByKey(  cf,  self->name,  NodeLayout_Type, NodeLayout,  True, data ) ;
	meshDecomp =  Stg_ComponentFactory_ConstructByKey(  cf,  self->name,  MeshDecomp_Type, MeshDecomp,  True, data ) ;
	
	_MeshLayout_Init( self, elementLayout, nodeLayout, meshDecomp );
}
void _RateFieldTimeIntegrator_AssignFromXML( void* rateFieldTimeIntegrator, Stg_ComponentFactory* cf, void* data ){
   RateFieldTimeIntegrator*  self = (RateFieldTimeIntegrator*) rateFieldTimeIntegrator;

   /* Construct Parent */
   _TimeIntegrand_AssignFromXML( self, cf, data );

   /** see Underworld/InputFiles/CumulativeTotalStrain.xml for a usage example */
   /** this provided swarm will have each particle extended to store the cumulative integral information */
   self->swarm      = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data  );
   /** this ratefield defines the rate of change used for the time integration */
   self->rateField  = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"RateField"          ,          FeVariable, True, data  );

}
Exemple #7
0
void _SwarmVariable_Construct( void* swarmVariable, Stg_ComponentFactory* cf, void* data ) {
	SwarmVariable*	        self         = (SwarmVariable*)swarmVariable;
	Swarm*                  swarm;
	Variable*               variable;
	Index                   dofCount;

	swarm    =  Stg_ComponentFactory_ConstructByKey(  cf,  self->name,  "Swarm", Swarm, True, data  ) ;
	variable =  Stg_ComponentFactory_ConstructByKey(  cf,  self->name,  "Variable", Variable,  False, data  ) ;
	dofCount = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "dofCount", 0 );

	_SwarmVariable_Init( self, swarm, variable, dofCount );
	
}
Exemple #8
0
void _SwarmAdvector_AssignFromXML( void* swarmAdvector, Stg_ComponentFactory* cf, void* data ) {
	SwarmAdvector*	            self          = (SwarmAdvector*) swarmAdvector;
	FeVariable*                 velocityField;
	GeneralSwarm*        swarm;
	PeriodicBoundariesManager*  periodicBCsManager;

	_TimeIntegrand_AssignFromXML( self, cf, data );

	velocityField      = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VelocityField", FeVariable, True, data  );
	swarm              = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", GeneralSwarm, True, data  );
	periodicBCsManager = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PeriodicBCsManager", PeriodicBoundariesManager, False, data  );

	_SwarmAdvector_Init( self, velocityField, swarm, periodicBCsManager );
}
void _Stokes_SLE_AssignFromXML( void* sle, Stg_ComponentFactory* cf, void* data ) {
	Stokes_SLE*       self = (Stokes_SLE*)sle;
	StiffnessMatrix*  kStiffMat;
	StiffnessMatrix*  gStiffMat;
	StiffnessMatrix*  dStiffMat;
	StiffnessMatrix*  cStiffMat;
	SolutionVector*   uSolnVec;
	SolutionVector*   pSolnVec;
	ForceVector*      fForceVec;
	ForceVector*      hForceVec;

	/* Construct Parent */
	_SystemLinearEquations_AssignFromXML( self, cf, data );

	kStiffMat =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StressTensorMatrix", StiffnessMatrix, True, data  );
	gStiffMat =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"GradientMatrix", StiffnessMatrix, True, data  );
	dStiffMat =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"DivergenceMatrix", StiffnessMatrix, False, data  );
	cStiffMat =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"CompressibilityMatrix", StiffnessMatrix, False, data  );

	uSolnVec  =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VelocityVector", SolutionVector, True, data  );
	pSolnVec  =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureVector", SolutionVector, True, data  );

	fForceVec =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ForceVector", ForceVector, True, data  );
	hForceVec =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ContinuityForceVector", ForceVector, True, data  );

	_Stokes_SLE_Init( self, kStiffMat, gStiffMat, dStiffMat, cStiffMat, uSolnVec, pSolnVec, fForceVec, hForceVec );
}
void _Energy_SLE_AssignFromXML( void* sle, Stg_ComponentFactory* cf, void* data ){
	Energy_SLE*      self = (Energy_SLE*)sle;
	StiffnessMatrix* stiffMat;
	SolutionVector*  solutionVec;
	ForceVector*     fVector;

	/* Construct Parent */
	_SystemLinearEquations_AssignFromXML( self, cf, data );

	stiffMat    =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)StiffnessMatrix_Type, StiffnessMatrix, True, data   ) ;
	solutionVec =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)SolutionVector_Type, SolutionVector, True, data   ) ;
	fVector     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)ForceVector_Type, ForceVector, True, data   ) ;

   _Energy_SLE_Init( self, stiffMat, solutionVec, fVector );
}
void _ParticleMelting_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ){
	ParticleMelting*          self              = (ParticleMelting*) _self;

	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", PICelleratorContext, False, data );
	if( !self->context  )
		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", PICelleratorContext, True, data  );

	_ParticleMelting_Init( 
			self,
			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"ExtractMelt", False  ),
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TemperatureField", FeVariable, True, data  ),
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, False, data  ),
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data),
			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Scaling", Scaling, True, data) );
}
void _PETScMGSolver_AssignFromXML( void* matrixSolver, Stg_ComponentFactory* cf, void* data ) {
	PETScMGSolver*	self = (PETScMGSolver*)matrixSolver;
	Bool		pure;
	unsigned	nLevels;
	unsigned	nCycles;
	unsigned	nDownIts, nUpIts;

	assert( self && Stg_CheckType( self, PETScMGSolver ) );
	assert( cf );

	//_PETScMatrixSolver_AssignFromXML( self, cf, data );

	pure = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"pure", False  );
	nLevels = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"levels", 1  );
	nCycles = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"cycles", 1  );
	nDownIts = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"downIterations", 1  );
	nUpIts = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"upIterations", 1  );
   
   Journal_Firewall( nLevels>1, NULL, "In func %s: Multigrid required mgLevels>1", __func__ );

	self->pure = pure;
	PETScMGSolver_SetLevels( self, nLevels );
	PETScMGSolver_SetLevelCycles( self, nLevels - 1, nCycles );
	PETScMGSolver_SetAllDownIterations( self, nDownIts );
	PETScMGSolver_SetAllUpIterations( self, nUpIts );

	self->opGen = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"opGenerator", MGOpGenerator, True, data  );
	MGOpGenerator_SetMatrixSolver( self->opGen, self );
	MGOpGenerator_SetNumLevels( self->opGen, nLevels );
}
void _Stokes_SLE_UzawaSolver_AssignFromXML( void* solver, Stg_ComponentFactory* cf, void* data ) {
	Stokes_SLE_UzawaSolver* self         = (Stokes_SLE_UzawaSolver*) solver;
	double                  tolerance;
	Iteration_Index         maxUzawaIterations, minUzawaIterations;
	StiffnessMatrix*        preconditioner;
	Bool                    useAbsoluteTolerance;
	Bool                    monitor;

	_SLE_Solver_AssignFromXML( self, cf, data );

	tolerance            = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"tolerance", 1.0e-5  );
	maxUzawaIterations   = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"maxIterations", 1000  );
	minUzawaIterations   = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"minIterations", 1  );
	useAbsoluteTolerance = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useAbsoluteTolerance", False  );
	monitor              = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"monitor", False  );

	preconditioner = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Preconditioner", StiffnessMatrix, False, data  );

	_Stokes_SLE_UzawaSolver_Init( self, preconditioner, maxUzawaIterations, minUzawaIterations, tolerance, useAbsoluteTolerance, monitor );

	if( self->velSolver == PETSC_NULL ) {
	    //KSPCreate( MPI_COMM_WORLD, &self->velSolver );
	    //KSPSetOptionsPrefix( self->pcSolver, "Uzawa_velSolver_" );
	}
}
void _DomainContext_AssignFromXML( void* context, Stg_ComponentFactory* cf, void* data ) {
   DomainContext* self = (DomainContext*)context;
   Dictionary     *contextDict = NULL;

   _AbstractContext_AssignFromXML( context, cf, data );

   self->dim          = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "dim", 2 );
   self->verticalAxis = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "VerticalAxis", 1 );

   /* try grab the scaling component and put it on the context 
    * check for the contextDict first as ConstructByKey NEEDS the conextDict 
    * and in units tests the contextDict sometime doesn't exist */
   contextDict = Dictionary_GetDictionary( cf->componentDict, self->name );
   if( contextDict ) {
      self->scaling = Stg_ComponentFactory_ConstructByKey(
         cf,
         self->name, 
         (Dictionary_Entry_Key)"Scaling",
         Scaling,
         False,
         data );
   }
   if( !self->scaling ) {
      self->scaling = Stg_ComponentFactory_ConstructByName(
         cf,
         (Name)"default_scaling", 
         Scaling, False, data ); 
   }

       /* The following is for backward compatiblity with old (GALE) xml files. */
   {
      /* Post change 1d3dc4e00549 in this repositroy, the old style of DofLayout 
       * XML definition was illegal. This change allows for the old style.
       *
       * Here we build all 'MeshVariable' components first.
       *
       * This is a hack, selective construction of general component over other is
       * a weakness to the object model and should be avoided. This section should
       * be removed in future and xml files updated in accordance with change 1d3dc4e00549  
       */

      Stg_Component *component=NULL;
      Index         component_I;
      for( component_I = 0; component_I < LiveComponentRegister_GetCount( cf->LCRegister ); component_I++ ){
         /* Grab component from register */
         component = LiveComponentRegister_At( cf->LCRegister, component_I ); 
         /* if not a "MeshVariable" do nothing */
         if( strcmp( component->type, MeshVariable_Type ) ) continue;

         if( component && !component->isConstructed ){
            Journal_Printf( cf->infoStream, "Constructing %s as %s\n", component->type, component->name );
            Stg_Component_AssignFromXML( component, cf, data, True );
         }

      }
   }

   _DomainContext_Init( self );
}
Exemple #15
0
void _Remesher_AssignFromXML( void* remesher, Stg_ComponentFactory* cf, void* data ) {
    Remesher*			self = (Remesher*)remesher;
    AbstractContext*	context;
    Mesh*					mesh;

    assert( self );
    assert( cf );
    assert( cf->componentDict );

    context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
    if( !context  )
        context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );

    mesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"mesh", Mesh, True, data  );

    _Remesher_Init ( self, context, mesh );
}
Exemple #16
0
void _SolutionVector_AssignFromXML( void* solutionVector, Stg_ComponentFactory* cf, void* data ) {
	SolutionVector*			self = (SolutionVector*)solutionVector;
	FeVariable*				feVariable = NULL;

	feVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FeVariable", FeVariable, True, data  );

	_SolutionVector_Init( self, MPI_COMM_WORLD, (FeVariable*)feVariable );
}
void _PeriodicBoundariesManager_AssignFromXML( void* periodicBCsManager, Stg_ComponentFactory* cf, void* data ) {
	PeriodicBoundariesManager*	self = (PeriodicBoundariesManager*)periodicBCsManager;
	Dictionary*						dictionary = NULL;
	Mesh*								mesh = NULL;
	Swarm*							swarm = NULL;
	PICelleratorContext*			context;

	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", PICelleratorContext, False, data );
	if( !context  ) 
		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", PICelleratorContext, True, data  );

	dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
	mesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"mesh", Mesh, True, data  );
	swarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  );

	_PeriodicBoundariesManager_Init( self, context, mesh, swarm, dictionary );
}
void _StiffnessMatrixTerm_AssignFromXML( void* stiffnessMatrixTerm, Stg_ComponentFactory* cf, void* data ) {
	StiffnessMatrixTerm*       self               = (StiffnessMatrixTerm*)stiffnessMatrixTerm;
	Swarm*                     swarm              = NULL;
	Stg_Component*             extraInfo;
	StiffnessMatrix*           stiffnessMatrix;
   FiniteElementContext*      context;
   
	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", FiniteElementContext, False, data );
	if( !context  )
		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", FiniteElementContext, False, data  );

	stiffnessMatrix = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StiffnessMatrix", StiffnessMatrix, False, data  ) ;
	swarm           = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  ) ;
	extraInfo       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ExtraInfo", Stg_Component, False, data  );

	_StiffnessMatrixTerm_Init( self, context, stiffnessMatrix, swarm, extraInfo );
}
void _Ppc_IsInsideShape_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ) {
	Ppc_IsInsideShape* self = (Ppc_IsInsideShape*)_self;

	/* Construct parent */
	_Ppc_AssignFromXML( self, cf, data );

   self->shape = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Shape", Stg_Shape, True, data );
}
Exemple #20
0
void _SROpGenerator_AssignFromXML( void* srOpGenerator, Stg_ComponentFactory* cf, void* data ) {
	SROpGenerator*	self = (SROpGenerator*)srOpGenerator;
	FeVariable*	var;

	assert( self && Stg_CheckType( self, SROpGenerator ) );

	var = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"fineVariable", FeVariable, True, data  );
	SROpGenerator_SetFineVariable( self, var );
}
void _LinkedDofInfo_AssignFromXML( void* linkedDofInfo, Stg_ComponentFactory *cf, void* data ){
	LinkedDofInfo*	self = (LinkedDofInfo*)linkedDofInfo;
	Dictionary*		dictionary;
	Mesh*				mesh = NULL;
	DofLayout*		dofLayout = NULL;
	DomainContext*	context;

	dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
	
	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", DomainContext, False, data );
	if( !context  ) 
		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, True, data  );

	mesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Mesh", Mesh, True, data  );
	dofLayout = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)DofLayout_Type, DofLayout, True, data  );

	_LinkedDofInfo_Init( self, context, mesh, dofLayout, dictionary ); 
}
void _Mesh_Algorithms_AssignFromXML( void* algorithms, Stg_ComponentFactory* cf, void* data ) {
    Mesh_Algorithms*	self = (Mesh_Algorithms*)algorithms;
    AbstractContext* context = NULL;

    context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
    if( !context  )
        context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
    _Mesh_Algorithms_Init( self, context );
}
void _lucIsosurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data )
{
   lucIsosurface*         self               = (lucIsosurface*)drawingObject;
   Index                  defaultRes;
   IJK                    resolution;
   double                 isovalue;
   lucDrawingObjectMask   mask;

   /* Construct Parent */
   _lucDrawingObject_AssignFromXML( self, cf, data );

   self->elementRes[I_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResI"  );
   self->elementRes[J_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResJ"  );
   self->elementRes[K_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResK"  );

   defaultRes = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 1.0);
   resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultRes);
   resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultRes);
   resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultRes);

   /* Get fields */
   self->isosurfaceField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"IsosurfaceField", FieldVariable, True, data  );
   self->colourField     = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourField", FieldVariable, False, data  );
   self->maskField       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaskField", FieldVariable, False, data  );

   if (defaultRes == 1 && (resolution[I_AXIS] > 2 || resolution[J_AXIS] > 2 || resolution[K_AXIS] > 2))
   {
      Journal_Printf( lucInfo, "** WARNING ** excessive isosurface resolution: samples per element reduced to 2,2,2 - was %d,%d,%d\n", resolution[I_AXIS], resolution[J_AXIS], resolution[K_AXIS]);
      resolution[I_AXIS] = resolution[J_AXIS] = resolution[K_AXIS] = 2;
   }

   lucDrawingObjectMask_Construct( &mask, self->name, cf, data );

   isovalue = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"isovalue", 0.0  );

   _lucIsosurface_Init(
      self,
      isovalue,
      resolution,
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawWalls", False  ),
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"sampleGlobal", False  ),
      &mask );
}
void _OneToOneMapper_AssignFromXML( void* mapper, Stg_ComponentFactory* cf, void* data ) {
	OneToOneMapper*		self = (OneToOneMapper*)mapper;
	MaterialPointsSwarm*	materialSwarm;

	_IntegrationPointMapper_AssignFromXML( self, cf, data );

	materialSwarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)MaterialPointsSwarm_Type, MaterialPointsSwarm, True, data  );

	_OneToOneMapper_Init( self, materialSwarm );
}
void _ElementCellLayout_AssignFromXML( void* elementCellLayout, Stg_ComponentFactory *cf, void* data ){
	ElementCellLayout* self = (ElementCellLayout*)elementCellLayout;
	Mesh*              mesh;

	_CellLayout_AssignFromXML( self, cf, data );

	mesh =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Mesh", Mesh, True, data  ) ;
	
	_ElementCellLayout_Init( self, mesh );
}
void _HeatingForce_AssignFromXML( void* heatingForce, Stg_ComponentFactory* cf, void* data ) {
	HeatingForce*			self 	= (HeatingForce*)heatingForce;
	IntegrationPointsSwarm*		swarm;

	_FeVariable_AssignFromXML( self, cf, data );

	swarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Swarm", IntegrationPointsSwarm, True, data );

	self->buoyancyMaterial = Stg_ComponentFactory_ConstructByKey( cf, self->name, "BuoyancyMaterial", BuoyancyMaterial, True, data );
	self->sle = Stg_ComponentFactory_ConstructByKey( cf, self->name, "SLE", SLE, True, data );
	self->materialIndex = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "materialIndex", 0 );
	self->cmm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "MaterialsManager", ConductivityMaterialManager, False, data );

	/* need to do this evaluation BEFORE solve, since the heat field we derive will be used as a force term */
	EP_InsertClassHookBefore( Context_GetEntryPoint( self->context, self->sle->executeEPName ), "MatrixSetup", 
				  _ParticleFeVariable_Execute, self );

	_ParticleFeVariable_Init( self, swarm, False );
}
void _CellLayout_AssignFromXML( void* cellLayout, Stg_ComponentFactory *cf, void* data ) {
	CellLayout*			self = (CellLayout*)cellLayout;
	AbstractContext*	context;

	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
   if( !context  )
      context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );

	_CellLayout_Init( self, context );
}
void _ParticleLayout_AssignFromXML( void* particleLayout, Stg_ComponentFactory *cf, void* data ) {
   ParticleLayout* self = (ParticleLayout*) particleLayout;
   AbstractContext* context=NULL;

   context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
   if( !context  )
      context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );

   _ParticleLayout_Init( self, context, GlobalCoordSystem, False );

}
void _ShapedMaterial_AssignFromXML( void* shapedMaterial, Stg_ComponentFactory* cf, void* data ) {
	ShapedMaterial*				self = (ShapedMaterial*) shapedMaterial;
	Materials_Register*	Materials_Register;
	PICelleratorContext*	context;
	FieldVariable*       materialIndexField;
	Dictionary*				materialDictionary;

	context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", PICelleratorContext, False, data );
	if( !context  ) 
		context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", PICelleratorContext, True, data  );

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

	/** user must provide a field which represents the shapes, with field values corresponding to current material index */
	/** (this field should be initialised later, so no circular dependency should result)                                */
	materialIndexField =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialIndexField", FieldVariable, True, data   ) ;
	Materials_Register = context->materials_Register;

	_ShapedMaterial_Init( self, context, materialIndexField, materialDictionary, Materials_Register );
}
void _MaterialFeVariable_AssignFromXML( void* materialFeVariable, Stg_ComponentFactory* cf, void* data ){
   MaterialFeVariable* self = (MaterialFeVariable*) materialFeVariable;
   Material*           material;
   
   material = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Material", Material, True, data );

   /* Construct Parent */
   _ParticleFeVariable_AssignFromXML( self, cf, data );

   _MaterialFeVariable_Init( self, material );
}