Ejemplo n.º 1
0
void _Geothermal_DepthMap_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
   Geothermal_DepthMap* self = (Geothermal_DepthMap*)component;
   Dictionary*          dictionary = Codelet_GetPluginDictionary( component, cf->rootDict );
   Stream*              errorStream = Journal_Register( ErrorStream_Type, Geothermal_DepthMap_Type );
	
   Stream_SetPrintingRank( errorStream, 0 );
   Journal_Printf( errorStream, "WARNING: \"DepthMap\" plugin is depricated, use \"FieldMap\" plugin instead" );

   self->swarm = Stg_ComponentFactory_ConstructByName(
      cf, Dictionary_GetString( dictionary, "Swarm" ), Swarm, True, data );

   self->context = (AbstractContext*)Stg_ComponentFactory_ConstructByName(
      cf, "context", UnderworldContext, True, data ); 

   self->depth = Dictionary_GetDouble_WithDefault( dictionary, (Dictionary_Entry_Key)"DepthFromSurface", 0.0 );
   self->outputPath = Dictionary_GetString_WithDefault( dictionary, (Dictionary_Entry_Key)"outputPath", "./output" );
   self->outputAllNodes = Dictionary_GetBool_WithDefault( dictionary, (Dictionary_Entry_Key)"OutputAllNodes", False );
   self->outputTopNodes = Dictionary_GetBool_WithDefault( dictionary, (Dictionary_Entry_Key)"OutputTopNodes", False );
   self->gocadOutput = Dictionary_GetBool_WithDefault( dictionary, (Dictionary_Entry_Key)"GOCADOutput", True );
   self->outputPath = Dictionary_Entry_Value_AsString( Dictionary_Get( dictionary, "outputPath" ) );

   self->field = Stg_ComponentFactory_ConstructByName(
      cf, Dictionary_GetString( dictionary, "Field" ), FeVariable, True, data );

   ContextEP_Append( self->context, AbstractContext_EP_Dump, Geothermal_DepthMap_Dump );
}
void _Experimental_CylinderNodeProfiling_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {

	AbstractContext* context;
	FeVariable*  temperatureField  = Stg_ComponentFactory_ConstructByName( cf, (Name)"TemperatureField", FeVariable, True, data  );
	FeMesh* mesh     = temperatureField->feMesh;

	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
	ContextEP_Append( context, AbstractContext_EP_FrequentOutput, Experimental_NodeTempProfile );
}
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 _AnalyticFeVariable_AssignFromXML( void* analyticFeVariable, Stg_ComponentFactory* cf, void* data ) {
   AnalyticFeVariable* self = (AnalyticFeVariable*)analyticFeVariable;
   Dictionary*         dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
   Name                numericFieldName;
   Name                functionName;
   FeVariable*         numericField = NULL;

   /* 
    * NOTE:
    * This component is a special case where it calls its ancestor's *_AssignFromXML
    * instead of its immediate parent's. This is because we don't want to re-declare 
    * the required FeVariable parameters in this component's XML block.
    */
   _FieldVariable_AssignFromXML( self, cf, data );

   numericFieldName = Dictionary_GetString( dictionary, (Dictionary_Entry_Key)"NumericField" );
   numericField = (FeVariable*)LiveComponentRegister_Get( cf->LCRegister, numericFieldName );

   if( !numericField ) 
      numericField = Stg_ComponentFactory_ConstructByName( cf, (Name)numericFieldName,
         FeVariable, True, data );

   functionName = Dictionary_GetString( dictionary, (Dictionary_Entry_Key)"Function" );

   /* 
    * NOTE:
    * The parent's *_Init function needs to be called to initialise
    * FeVariable-specific attributes.
    */
   _FeVariable_Init( (FeVariable*)self, numericField->feMesh, NULL,
      NULL, False, NULL, NULL, NULL, True, False );

   _AnalyticFeVariable_Init( self, functionName, numericField );
}
void _StGermain_VaryingCornerAttractors_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
	DomainContext*   context;

	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, True, data  );
	
	ContextEP_ReplaceAll( context, AbstractContext_EP_Solve, StGermain_VaryingCornerAttractors_UpdatePositions );
}
Ejemplo n.º 6
0
void _StgFEM_Document_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
   Codelet*           self = (Codelet*)component;
   AbstractContext*   context;
   ConditionFunction* condFunc;
   Dictionary*        pluginDict = Codelet_GetPluginDictionary( component, cf->rootDict );
   DocumentationComponentFactory* dcf;
   Stream* componentListStream;

   context = (AbstractContext*)Stg_ComponentFactory_ConstructByName(
      cf,
      Dictionary_GetString( pluginDict, (Dictionary_Entry_Key)"Context" ),
      AbstractContext,
      True,
      data );


   /* Print list of all components */
   componentListStream = Journal_Register( Info_Type, (Name)"componentList"  );
   Stream_RedirectFile_WithPrependedPath( componentListStream, context->outputPath, "ComponentList.txt" );
   Stg_ComponentRegister_PrintAllTypes( Stg_ComponentRegister_Get_ComponentRegister(), componentListStream );

   /* Print info for one component */
   dcf = DocumentationComponentFactory_New( );
   Stream_RedirectFile_WithPrependedPath( dcf->infoStream, context->outputPath, "Documentation.txt" );
   DocumentationComponentFactory_DocumentType( dcf, Dictionary_GetString( context->dictionary, (Dictionary_Entry_Key)"documentType" ) );

   exit( EXIT_SUCCESS  );
}
Ejemplo n.º 7
0
void _SwarmDump_Construct( void* swarmDump, Stg_ComponentFactory* cf, void* data ) {
	SwarmDump*	            self         = (SwarmDump*)swarmDump;
	Swarm**                 swarmList;
	AbstractContext*        context;
	Bool                    newFileEachTime;
	Index                   swarmCount;

	context = Stg_ComponentFactory_ConstructByName( cf, "context", AbstractContext, True, data ) ;
	swarmList = Stg_ComponentFactory_ConstructByList( 
		cf, 
		self->name, 
		"Swarm", 
		Stg_ComponentFactory_Unlimited, 
		Swarm, 
		True, 
		&swarmCount,
		data ) ;
	newFileEachTime = Stg_ComponentFactory_GetBool( cf, self->name, "newFileEachTime", True );

	_SwarmDump_Init( 
			self,
			context,
			swarmList,
			swarmCount,
			newFileEachTime );

	Memory_Free( swarmList );
}
void _Viscoelastic_ViscoelasticCantileverBeam_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
	UnderworldContext*  context = Stg_ComponentFactory_ConstructByName( cf, "context", UnderworldContext, True, data );
	
	ContextEP_Append( context, AbstractContext_EP_FrequentOutput, CalcDeflectionAndCheckGravity );

	StgFEM_FrequentOutput_PrintString( context, "Deflection" );
}
void _RSGenerator_AssignFromXML( void* meshGenerator, Stg_ComponentFactory* cf, void* data )
{
   RSGenerator*			self 		= (RSGenerator*)meshGenerator;
   FiniteElementContext*	context 	= Stg_ComponentFactory_ConstructByName( cf, (Name)"context", FiniteElementContext, True, NULL  );
   Dictionary*			dict		= Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, (Dictionary_Entry_Key)self->name ) );
   Dictionary_Entry_Value	*minList, *maxList, *tmp;
   char*			rootKey;
   unsigned			d_i;
   double 			maxVal;

   _CartesianGenerator_AssignFromXML( meshGenerator, cf, data );

   // mesh min/max coords are written to file from the mesh->min/maxGlobalCoord field. these differ from the min/max
   // coords as defined in the RSGenerator->min/maxCrd (these are in r-theta-phi, not x-y-z), so if we're restarting
   // we need to over-ride the coords from the hdf5 mesh file with those from the xml (assuming they don't differ
   // between runs...
   if( self->nDims > 2 ) {
      if( context->loadFromCheckPoint ) {
         minList = Dictionary_Get( dict, (Dictionary_Entry_Key)"minCoord" );
         maxList = Dictionary_Get( dict, (Dictionary_Entry_Key)"maxCoord" );
         if( minList && maxList ) {
                assert( Dictionary_Entry_Value_GetCount( minList ) >= self->nDims );
                assert( Dictionary_Entry_Value_GetCount( maxList ) >= self->nDims  );
                for( d_i = 0; d_i < self->nDims; d_i++ ) {
                   tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
                   rootKey = Dictionary_Entry_Value_AsString( tmp );

                   if( !Stg_StringIsNumeric( (char*)rootKey ) )
                      tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
                   self->crdMin[d_i] = Dictionary_Entry_Value_AsDouble( tmp );

                   tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
                   rootKey = Dictionary_Entry_Value_AsString( tmp );

                   if( !Stg_StringIsNumeric( (char*)rootKey ) )
                      tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
                   self->crdMax[d_i] = Dictionary_Entry_Value_AsDouble( tmp );
                   /* test to ensure provided domain is valid */
                   maxVal = (abs(self->crdMax[d_i]) > abs(self->crdMin[d_i])) ? abs(self->crdMax[d_i]) : abs(self->crdMin[d_i]);
                   if( maxVal == 0 ) maxVal = 1;  /* if maxVal is zero, then both numbers must be zero, set to one as next test will fail */
                   Journal_Firewall( ( ( (self->crdMax[d_i] - self->crdMin[d_i])/maxVal) > 1E-10 || d_i==J_AXIS), global_error_stream,
                     "\n\nError in %s for %s '%s'\n\n"
                     "Dimension of domain (min = %f, max = %f) for component number %u is not valid.\n\n",
                     __func__, self->type, self->name, self->crdMin[d_i], self->crdMax[d_i], d_i );
                }
         }
      }
      // phi = (pi/2, pi)
      Journal_Firewall( !(fabs(self->crdMin[2] -self->crdMax[2])>=179.99 || self->crdMax[2] < self->crdMin[2]),
         global_error_stream, "\nError in %s: Phi definition is wrong. Ensure minZ < maxZ & abs(minZ-maxZ)<180\n", __func__);
   }
   Journal_Firewall( self->nDims==3, global_error_stream,
        "Error in %s: Must have 3 dimensions for component %s\n", __func__, self->name );
   // check domain size is valid
   Journal_Firewall( !(self->crdMin[0] <= 0 || self->crdMax[0] < self->crdMin[0]), global_error_stream,
        "Error in %s: Radius definition is wrong. Ensure maxX > minX & minX > 0\n", __func__ );

   Journal_Firewall(!( fabs(self->crdMin[1]-self->crdMax[1]) >= 179.99 || self->crdMax[1] < self->crdMin[1] ),
         global_error_stream, "Error in %s: Theta definition is wrong. Ensure minY < maxY && abs(minY-maxY) < 180\n", __func__ );
}
Ejemplo n.º 10
0
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 );
}
void _SimpleShearAnalytic_AssignFromXML( void* analyticSolution, Stg_ComponentFactory* cf, void* data ) {
	SimpleShearAnalytic *self = (SimpleShearAnalytic*)analyticSolution;
	FeVariable*       velocityField;
	FeVariable*       pressureField;

	_AnalyticSolution_AssignFromXML( self, cf, data );

	velocityField = Stg_ComponentFactory_ConstructByName( cf, (Name)"VelocityField", FeVariable, True, data  ); 
	AnalyticSolution_RegisterFeVariableWithAnalyticFunction( self, velocityField, SimpleShearAnalytic_VelocityFunction );
	
	pressureField = Stg_ComponentFactory_ConstructByName( cf, (Name)"PressureField", FeVariable, True, data  ); 
	AnalyticSolution_RegisterFeVariableWithAnalyticFunction( self, pressureField, SimpleShearAnalytic_PressureFunction );
	
	/* Set constants */
	self->centreY = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"simpleShearCentreY", 0.0  );
	self->factor  = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"SimpleShearFactor", 1.0 );
}
void HomogeneousEssentialBCs_Velocity_SkewToMesh( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* data, void* _result ) {
	DomainContext*	context = (DomainContext*)_context;
	HomogeneousEssentialBCs*  self    = Stg_ComponentFactory_ConstructByName( context->CF, (Name)HomogeneousEssentialBCs_Type, HomogeneousEssentialBCs, True, 0 );
	double*                 result  = (double*) _result;
	
	result[ I_AXIS ] =  cos( self->angle );
	result[ J_AXIS ] =  sin( self->angle  );
}
Ejemplo n.º 13
0
void _SnacRestartOld_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;
	char fname[PATH_MAX];
	FILE *fp;

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 

#ifdef DEBUG
	printf( "In: _SnacRestartOld_Register( void* )\n" );
#endif

	if( context->rank == 0 ) {
		sprintf( fname, "%s/coord.%d", context->outputPath, context->rank );
		Journal_Firewall( ( ( fp = fopen( fname, "r") ) == NULL ), 
				  context->snacError, 
				  "\n\n ###### RESTARTER ERROR ######\n Do NOT restart in %s!!\n All the existing outputs will be overwritten !!\n If absolutely sure, remove the existing outputs first.\n #############################\n\n", 
				  context->outputPath );
	}

	/*
	 *  Shift the time step range to start from the restart time step
	 *    - this doesn't seem to work since the changes don't appear to propagate into StGermain
	 *     far enough to cause the maxTimeSteps to stop the simulation when desired
	 */
/* 	context->timeStep += context->restartStep; */
/* 	context->maxTimeSteps += context->restartStep; */

	EntryPoint_InsertBefore(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacRestartOld_Type,
		_SnacRestartOld_resetMinLengthScale,
		SnacRestartOld_Type );
	EntryPoint_InsertBefore(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacRestartOld_Type,
		_SnacRestartOld_InitialCoords,
		SnacRestartOld_Type );
	EntryPoint_InsertBefore(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacRestartOld_Type,
		_SnacRestartOld_InitialVelocities,
		SnacRestartOld_Type );
	EntryPoint_InsertBefore(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacRestartOld_Type,
		_SnacRestartOld_InitialStress,
		SnacRestartOld_Type );

/* 	_SnacRestartOld_resetMinLengthScale(context,data); */
/* 	_SnacRestartOld_InitialCoords(context,data); */
/* 	_SnacRestartOld_InitialVelocities(context,data); */
/* 	_SnacRestartOld_InitialStress(context,data); */
}
Ejemplo n.º 14
0
void _SnacPlastic_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;
	EntryPoint* 	interpolateElementEP;

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 

	#ifdef DEBUG
		printf( "In: _SnacPlastic_Register( void*, void* )\n" );
	#endif
	
	/* Add extensions to nodes, elements and the context */
	SnacPlastic_ElementHandle = ExtensionManager_Add( context->mesh->elementExtensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Element) );
	SnacPlastic_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Context) );
	
	#ifdef DEBUG
		printf( "\tcontext extension handle: %u\n", SnacPlastic_ContextHandle );
		printf( "\telement extension handle: %u\n", SnacPlastic_ElementHandle );
	#endif
	
	/* Add extensions to the entry points */
	EntryPoint_Append( 
		Context_GetEntryPoint( context,	Snac_EP_Constitutive ),
		SnacPlastic_Type, 
		SnacPlastic_Constitutive, 
		SnacPlastic_Type );
	EntryPoint_InsertBefore( 
		Context_GetEntryPoint( context,	AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacPlastic_Type, 
		SnacPlastic_InitialConditions,
		SnacPlastic_Type );
	EntryPoint_Prepend( /* Dump the initial plastic strain */
		Context_GetEntryPoint( context, AbstractContext_EP_Execute ),
		"SnacPlastic_Write",
		_SnacPlastic_WritePlasticStrain,
		SnacPlastic_Type );
	EntryPoint_Append( /* and dump each loop */
		Context_GetEntryPoint( context, Snac_EP_CalcStresses ),
		"SnacPlastic_Write",
		_SnacPlastic_WritePlasticStrain,
		SnacPlastic_Type );
	
	/* Add extensions to the interpolate element entry point, but it will only exist if the remesher is loaded. */
	interpolateElementEP = Context_GetEntryPoint( context,	"SnacRemesher_EP_InterpolateElement" );
	if( interpolateElementEP ) {
		EntryPoint_Append( 
			interpolateElementEP,
			SnacPlastic_Type, 
			_SnacPlastic_InterpolateElement, 
			SnacPlastic_Type );
	}


	/* Construct. */
	_SnacPlastic_ConstructExtensions( context, data );
}
Ejemplo n.º 15
0
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 );
}
Ejemplo n.º 16
0
void _Underworld_Mobility_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
   UnderworldContext*  context;

   context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", UnderworldContext, True, data ); 

   Underworld_Mobility_PrintHeaderToFile( context  );
   ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, Underworld_Mobility_Setup );
   ContextEP_Append( context, AbstractContext_EP_FrequentOutput     , Underworld_Mobility_Dump );
}
Ejemplo n.º 17
0
void _SnacHillSlope_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;

	#ifdef DEBUG
	fprintf(stderr, "Entering Register.c...\n");
	#endif

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
	
	Journal_Printf( context->debug, "In: %s\n", __func__ );
	
	
	/* Add extensions to nodes, elements and the context */
	SnacHillSlope_ContextHandle = ExtensionManager_Add(
		context->extensionMgr,
		SnacHillSlope_Type,
		sizeof(SnacHillSlope_Context) );
	
	/* Add extensions to the entry points */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Build ),
		SnacHillSlope_Type,
		_SnacHillSlope_Build,
		SnacHillSlope_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		SnacHillSlope_Type,
		_SnacHillSlope_InitialConditions,
		SnacHillSlope_Type );

/* 	EntryPoint_Append( */
/* 		Context_GetEntryPoint( context, Snac_EP_Constitutive ), */
/* 		SnacHillSlope_Type, */
/* 		_SnacHillSlope_Constitutive, */
/* 		SnacHillSlope_Type ); */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ),
		SnacHillSlope_Type,
		_SnacHillSlope_DeleteExtensions,
		SnacHillSlope_Type );


	/* Construct. */
	_SnacHillSlope_ConstructExtensions( context, data );

	#ifdef DEBUG
	fprintf(stderr, "In Register.c\n");
	#endif

	#ifdef DEBUG
	fprintf(stderr, "...leaving Register.c\n");
	#endif


}
void _StGermain_SingleAttractor_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
	DomainContext*   context;

	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, True, data  );
	Stream_SetPrintingRank( 
		Journal_Register( Info_Type, (Name)"Context"  ),
		Dictionary_GetUnsignedInt_WithDefault( context->dictionary, "procToWatch", 0 ) );
	
	ContextEP_ReplaceAll( context, AbstractContext_EP_Solve, StGermain_SingleAttractor_UpdatePositions );
}
void _Underworld_DensityChange_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
	UnderworldContext* context;

	context = (UnderworldContext*)Stg_ComponentFactory_ConstructByName( cf, (Name)"context", UnderworldContext, True, data  ); 

	/* Add functions to entry points */
	ContextEP_Append( context, AbstractContext_EP_Initialise, Underworld_DensityChange_Setup );
	ContextEP_Append( context, AbstractContext_EP_FrequentOutput, Underworld_DensityChange_Check );
	
}
void _HomogeneousEssentialBCs_AssignFromXML( void* analyticSolution, Stg_ComponentFactory* cf, void* data ) {
	HomogeneousEssentialBCs* self = (HomogeneousEssentialBCs*)analyticSolution;
	AbstractContext*       context;
	ConditionFunction*     condFunc;

	_AnalyticSolution_AssignFromXML( self, cf, data );

	self->temperatureField = Stg_ComponentFactory_ConstructByName( cf, (Name)"TemperatureField", FeVariable, True, data  ); 
	AnalyticSolution_RegisterFeVariableWithAnalyticFunction( self, self->temperatureField, HomogeneousEssentialBCs_TemperatureFunction );

	self->angle = StGermain_DegreeToRadian (Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"VelocitySkewAngle", 45.0 )  );

	/* Create Condition Functions */
	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ); 
	condFunc = ConditionFunction_New( HomogeneousEssentialBCs_Velocity_SkewToMesh, (Name)"Velocity_SkewToMesh", NULL  );
	ConditionFunction_Register_Add( context->condFunc_Register, condFunc );
	condFunc = ConditionFunction_New( HomogeneousEssentialBCs_TemperatureBC, (Name)"Temperature_StepFunction", NULL  );
	ConditionFunction_Register_Add( context->condFunc_Register, condFunc );
}
Ejemplo n.º 21
0
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 _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 );
}
Ejemplo n.º 24
0
void _Ppc_VD_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data )
{
   Ppc_VD* self = (Ppc_VD*)_self;

   /* The PpcManager */
	self->manager = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Manager", PpcManager, False, data );
	if( !self->manager  )
		self->manager = Stg_ComponentFactory_ConstructByName( cf, (Name)"default_ppcManager", PpcManager, True, data );
   /* Construct parent */
   _Ppc_AssignFromXML( self, cf, data );
	self->strainRateTag = PpcManager_GetPpcFromDict( self->manager, cf, self->name, "StrainRate", "" );
	self->viscosityTag = PpcManager_GetPpcFromDict( self->manager, cf, self->name, "Viscosity", "" );
}
Ejemplo n.º 25
0
void _SLE_Solver_AssignFromXML( void* sleSolver, Stg_ComponentFactory* cf, void* data ) {
	SLE_Solver*		self = (SLE_Solver*)sleSolver;
	Bool            useStatSolve;
	int             nStatReps;

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

	useStatSolve = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"statSolve", False  );
	nStatReps = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"statReps", 0  );

	_SLE_Solver_Init( self, useStatSolve, nStatReps );
}
void HomogeneousEssentialBCs_TemperatureBC( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* data, void* _result ) {
	DomainContext*	context    = (DomainContext*)_context;
	HomogeneousEssentialBCs*  self       = Stg_ComponentFactory_ConstructByName( context->CF, (Name)HomogeneousEssentialBCs_Type, HomogeneousEssentialBCs, True, 0 );
	FeVariable*             feVariable = NULL;
	FeMesh*			mesh       = NULL;
	double*                 result     = (double*) _result;
	double*                 coord;
	
	feVariable = (FeVariable* )FieldVariable_Register_GetByName( context->fieldVariable_Register, "TemperatureField" );
	mesh       = feVariable->feMesh;
	coord = Mesh_GetVertex( mesh, node_lI );

	HomogeneousEssentialBCs_TemperatureFunction( self, feVariable, coord, result );
}
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 _JAMBoxExampleComponent_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data )
{
   JAMBoxExampleComponent*  self = (JAMBoxExampleComponent*) _self;
   Bool                     someParameter;

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

   /** add the parameters and dependencies here */
   someParameter = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"SomeParameter", True );

   _JAMBoxExampleComponent_Init( self, someParameter );

}
void _BuoyancyForceTermPpc_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ) {
    BuoyancyForceTermPpc* self = (BuoyancyForceTermPpc*)_self;
    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  );

    self->density_id = PpcManager_GetPpcFromDict( mgr, cf, self->name, (Dictionary_Entry_Key)"DensityLabel", "DensityLabel" );

    _BuoyancyForceTermPpc_Init( self, mgr );

}
Ejemplo n.º 30
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 );
}