void _SwarmAdvector_Build( void* swarmAdvector, void* data ) { SwarmAdvector* self = (SwarmAdvector*) swarmAdvector; GeneralSwarm *swarm=NULL; Stg_Component_Build( self->velocityField, data, False ); Stg_Component_Build( self->swarm, data, False ); swarm=self->swarm; /* Test if mesh is periodic and a periodic boundaries manager hasn't been given */ if ( !self->periodicBCsManager && Stg_Class_IsInstance( ((ElementCellLayout*)swarm->cellLayout)->mesh->generator, CartesianGenerator_Type ) ) { CartesianGenerator* cartesianGenerator = (CartesianGenerator*) ((ElementCellLayout*)swarm->cellLayout)->mesh->generator; if ( cartesianGenerator->periodic[ I_AXIS ] || cartesianGenerator->periodic[ J_AXIS ] || cartesianGenerator->periodic[ K_AXIS ] ) { /* Create a periodicBCsManager if there isn't one already */ self->periodicBCsManager = PeriodicBoundariesManager_New( "periodicBCsManager", (PICelleratorContext*)self->context, (Mesh*)((ElementCellLayout*)swarm->cellLayout)->mesh, (Swarm*)swarm, NULL ); } } if ( self->periodicBCsManager ) Stg_Component_Build( self->periodicBCsManager, data, False ); _TimeIntegrand_Build( self, data ); }
void _MeshAdaptor_Build( void* _adaptor, void* data ) { MeshAdaptor* self = (MeshAdaptor*)_adaptor; if( self->generator ) Stg_Component_Build( self->generator, data, False ); if( self->srcMesh ) Stg_Component_Build( self->srcMesh, data, False ); _MeshGenerator_Build( self, data ); }
void _lucIsosurface_Build( void* drawingObject, void* data ) { lucIsosurface* self = (lucIsosurface*)drawingObject; /* Legacy, probably not necessary... */ Stg_Component_Build( self->isosurfaceField, data, False ); Stg_Component_Build( self->colourField, data, False ); Stg_Component_Build( self->maskField, data, False ); }
void _IntegrationPointsSwarm_Build( void* integrationPoints, void* data ) { IntegrationPointsSwarm* self = (IntegrationPointsSwarm*) integrationPoints; _Swarm_Build( self, data ); Stg_Component_Build( self->localCoordVariable, data, False ); Stg_Component_Build( self->weightVariable, data, False ); Stg_Component_Build( self->mesh, data, False ); }
void _Spherical_CubedSphereNusselt_Build( void* component, void* data ) { Spherical_CubedSphereNusselt* self = (Spherical_CubedSphereNusselt*)component; Stg_Component_Build( self->gaussSwarm, data, False ); Stg_Component_Build( self->advectiveHeatFluxField, data, False ); Stg_Component_Build( self->temperatureTotalDerivField, data, False ); _Codelet_Build( component, data ); }
void StgFEM_GMG_Build( void* _self, void* data ) { StgFEM_GMG* self = (StgFEM_GMG*)_self; Stg_Component_Build( self->sle, data, False ); /* Setup the operator generator. */ SROpGenerator_SetFineVariable( self->opGen, self->sle->uSolnVec->feVariable ); Stg_Component_Build( self->opGen, data, False ); }
void _StoreVisc_Build( void* _self, void* data ) { StoreVisc* self = (StoreVisc*) _self; /* Build parent */ _Rheology_Build( self, data ); Stg_Component_Build( self->swarmVariable, data, False); Stg_Component_Build( self->materialPointsSwarm, data, False); }
void _Mesh_Build( void* mesh, void* data ) { Mesh* self = (Mesh*)mesh; unsigned nDims; unsigned d_i; assert( self ); if( self->generator ) { Stg_Component_Build( self->generator, data, False ); MeshGenerator_Generate( self->generator, self, data ); } if( self->algorithms ) Stg_Component_Build( self->algorithms, data, False ); nDims = Mesh_GetDimSize( self ); if( !nDims ){ self->isBuilt = False; return; } self->topoDataInfos = Memory_Alloc_Array( ExtensionManager*, nDims, "mesh::topoDataInfos" ); self->topoDatas = Memory_Alloc_Array( void*, nDims, "mesh::topoDatas" ); for( d_i = 0; d_i < nDims; d_i++ ) { char name[20]; unsigned size; if( !UIntMap_Map( self->topoDataSizes, d_i, &size ) || !size || !Mesh_GetDomainSize( self, d_i ) ) { self->topoDataInfos[d_i] = NULL; self->topoDatas[d_i] = NULL; continue; } sprintf( name, "topoData(%d)", d_i ); self->topoDataInfos[d_i] = ExtensionManager_New_OfStruct( name, size ); self->topoDatas[d_i] = (void*)ExtensionManager_Malloc( self->topoDataInfos[d_i], Mesh_GetDomainSize( self, d_i ) ); } /* ** Set up the geometric information. */ self->minAxialSep = Memory_Alloc_Array( double, nDims, "Mesh::minAxialSep" ); self->minLocalCrd = Memory_Alloc_Array( double, nDims, "Mesh::minLocalCrd" ); self->maxLocalCrd = Memory_Alloc_Array( double, nDims, "Mesh::maxLocalCrd" ); self->minDomainCrd = Memory_Alloc_Array( double, nDims, "Mesh::minLocalCrd" ); self->maxDomainCrd = Memory_Alloc_Array( double, nDims, "Mesh::maxLocalCrd" ); self->minGlobalCrd = Memory_Alloc_Array( double, nDims, "Mesh::minGlobalCrd" ); self->maxGlobalCrd = Memory_Alloc_Array( double, nDims, "Mesh::maxGlobalCrd" ); Mesh_DeformationUpdate( self ); }
void _FieldVariableConditionFunctionSecondCopy_Build( void* component, void* data ) { FieldVariableConditionFunctionSecondCopy* self = (FieldVariableConditionFunctionSecondCopy*)component; Stg_Component_Build( self->fieldVariable, data, False ); Stg_Component_Build( self->targetfeVariable, data, False ); /** also initialise now */ Stg_Component_Initialise( self->fieldVariable, data, False ); /** just set this large enough for a 3d vector */ self->value = Memory_Alloc_Array( double, 3, "interValue" ); }
void _Underworld_Vrms_Build( void* component, void* data ) { Underworld_Vrms* self = (Underworld_Vrms*)component; assert( self ); Stg_Component_Build( self->gaussSwarm, data, False ); Stg_Component_Build( self->velocityField, data, False ); Stg_Component_Build( self->velocitySquaredField, data, False ); _Codelet_Build( self, data ); }
void _SUPGAdvDiffTermPpc_Build( void* residual, void* data ) { SUPGAdvDiffTermPpc* self = (SUPGAdvDiffTermPpc*)residual; _ForceTerm_Build( self, data ); //Stg_Component_Build( self->sle, data, False ); Stg_Component_Build( self->velocityField, data, False ); Stg_Component_Build( self->phiField, data, False ); Stg_Component_Build( self->mgr, data, False ); }
void _Trubitsyn2006_Build( void* analyticSolution, void* data ) { Trubitsyn2006* self = (Trubitsyn2006*)analyticSolution; _Codelet_Build( self, data ); Stg_Component_Build(self->velocityField, data, False); Stg_Component_Build(self->pressureField, data, False); /* Add this plugin's analytic functions into the register. */ AnalyticFunction_Add( _Trubitsyn2006_VelocityFunction, (Name)"_Trubitsyn2006_VelocityFunction" ); AnalyticFunction_Add( _Trubitsyn2006_PressureFunction, (Name)"_Trubitsyn2006_PressureFunction" ); AnalyticFunction_Add( _Trubitsyn2006_ViscosityFunction, (Name)"_Trubitsyn2006_ViscosityFunction" ); }
void _StiffnessMatrixTerm_Build( void* stiffnessMatrixTerm, void* data ) { StiffnessMatrixTerm* self = (StiffnessMatrixTerm*)stiffnessMatrixTerm; Journal_DPrintf( self->debug, "In %s - for %s\n", __func__, self->name ); Stream_IndentBranch( StgFEM_Debug ); /* ensure integrationSwarm is built */ Stg_Component_Build( self->integrationSwarm, data, False ); if ( self->extraInfo ) Stg_Component_Build( self->extraInfo, data, False ); Stream_UnIndentBranch( StgFEM_Debug ); }
void _PeriodicBoundariesManager_Build( void* periodicBCsManager, void* data ) { PeriodicBoundariesManager* self = (PeriodicBoundariesManager*)periodicBCsManager; Dictionary_Entry_Value* periodicBCsList = NULL; Stg_Component_Build( self->swarm, data, False ); Stg_Component_Build( self->mesh, data, False ); self->size = 4; self->boundaries = Memory_Alloc_Array( PeriodicBoundary, self->size, "PeriodicBoundariesManager->boundaries" ); if ( self->dictionary ) { periodicBCsList = Dictionary_Get( self->dictionary, (Dictionary_Entry_Key)"PeriodicBoundaries" ); /* Dictionary entry is optional - users may prefer to enter in code */ if ( periodicBCsList ) { Index numPeriodicBCs = 0; Index periodicBC_I = 0; Dictionary_Entry_Value* periodicBC = NULL; char* perBCAxis = NULL; numPeriodicBCs = Dictionary_Entry_Value_GetCount( periodicBCsList ); for ( periodicBC_I = 0; periodicBC_I < numPeriodicBCs; periodicBC_I++ ) { periodicBC = Dictionary_Entry_Value_GetElement( periodicBCsList, periodicBC_I ); perBCAxis = Dictionary_Entry_Value_AsString( periodicBC ); if ( 0 == strcmp( perBCAxis, "I_AXIS" ) ) { PeriodicBoundariesManager_AddPeriodicBoundary( self, I_AXIS ); } else if ( 0 == strcmp( perBCAxis, "J_AXIS" ) ) { PeriodicBoundariesManager_AddPeriodicBoundary( self, J_AXIS ); } else if ( 0 == strcmp( perBCAxis, "K_AXIS" ) ) { PeriodicBoundariesManager_AddPeriodicBoundary( self, K_AXIS ); } } } } /* Test if mesh is periodic */ else if ( Stg_Class_IsInstance( self->mesh->generator, CartesianGenerator_Type ) ) { CartesianGenerator* cartesianGenerator = (CartesianGenerator*) self->mesh->generator; Dimension_Index dim_I; for ( dim_I = 0 ; dim_I < self->swarm->dim ; dim_I++ ) { /* Add boundaries straight from mesh generator */ if ( cartesianGenerator->periodic[ dim_I ] ) PeriodicBoundariesManager_AddPeriodicBoundary( self, dim_I ); } } }
Variable* Mesh_GenerateElGlobalIdVar( void* mesh ) { /* Returns a Variable that stores the global element indices. * Assumes the number of mesh elements never changes. */ Mesh* self = (Mesh*)mesh; char* name; unsigned dim; // if variable already exists return it if( self->eGlobalIdsVar ) return self->eGlobalIdsVar; dim = Mesh_GetDimSize(mesh); // Create the Variable data structure, int[local node count] self->lEls = Mesh_GetLocalSize( self, dim ); self->elgid = Memory_Alloc_Array( int, self->lEls, "Mesh::vertsgid" ); Stg_asprintf( &name, "%s-%s", self->name, "verticesGlobalIds" ); self->eGlobalIdsVar = Variable_NewScalar( name, NULL, Variable_DataType_Int, &self->lEls, NULL, (void**)&self->elgid, NULL ); Stg_Component_Build(self->eGlobalIdsVar, NULL, False); Stg_Component_Initialise(self->eGlobalIdsVar, NULL, False); free(name); // Evaluate the global indices for the local nodes int ii, gid; for( ii=0; ii<self->lEls; ii++ ) { gid = Mesh_DomainToGlobal( self, dim, ii ); Variable_SetValue( self->eGlobalIdsVar, ii, (void*)&gid ); } // return new variable return self->eGlobalIdsVar; }
void _MeshParticleLayout_Build( void* meshParticleLayout, void* data ) { MeshParticleLayout* self = (MeshParticleLayout*)meshParticleLayout; assert( self ); Stg_Component_Build( self->mesh, NULL, False ); }
FeMesh* buildMesh() { CartesianGenerator* gen; int nRanks; unsigned sizes[3]; double minCrd[3]; double maxCrd[3]; FeMesh* mesh; insist( MPI_Comm_size( MPI_COMM_WORLD, &nRanks ), == MPI_SUCCESS ); sizes[0] = sizes[1] = sizes[2] = nRanks * 4; minCrd[0] = minCrd[1] = minCrd[2] = 0.0; maxCrd[0] = minCrd[1] = minCrd[2] = (double)nRanks; gen = CartesianGenerator_New( "", NULL ); MeshGenerator_SetDimSize( gen, 3 ); CartesianGenerator_SetShadowDepth( gen, 1 ); CartesianGenerator_SetTopologyParams( gen, sizes, 0, NULL, NULL ); CartesianGenerator_SetGeometryParams( gen, minCrd, maxCrd ); mesh = FeMesh_New( "", NULL ); Mesh_SetGenerator( mesh, gen ); FeMesh_SetElementFamily( mesh, "linear" ); Stg_Component_Build( mesh, NULL, False ); return mesh; }
void _TimeIntegrand_Build( void* timeIntegrand, void* data ) { TimeIntegrand* self = (TimeIntegrand*)timeIntegrand; Journal_DPrintf( self->debug, "In %s for %s '%s'\n", __func__, self->type, self->name ); Stg_Component_Build( self->variable, NULL, False ); }
void _Ppc_IsInsideShape_Build( void* _self, void* data ) { Ppc_IsInsideShape* self = (Ppc_IsInsideShape*)_self; /* Build parent */ _Ppc_Build( self, data ); Stg_Component_Build( self->shape, NULL, False ); }
void _GALENonNewtonian_Build( void* _self, void* data ){ GALENonNewtonian* self = (GALENonNewtonian*)_self; _Rheology_Build( self, data ); Stg_Component_Build( self->strainRateInvField, data, False ); }
void _MaterialFeVariable_Build( void* materialFeVariable, void* data ) { MaterialFeVariable* self = (MaterialFeVariable*) materialFeVariable; IntegrationPointsSwarm* swarm; Name tmpName; Variable_Register* variable_Register = NULL; Stg_Component_Build( self->feMesh, data, False ); /* Create Dof Layout */ swarm = self->picIntegrationPoints; if ( swarm->swarmVariable_Register ) variable_Register = swarm->swarmVariable_Register->variable_Register; tmpName = Stg_Object_AppendSuffix( self, (Name)"DataVariable" ); self->dataVariable = Variable_NewScalar( tmpName, (AbstractContext*)self->context, Variable_DataType_Double, &((IGraph*)self->feMesh->topo)->remotes[MT_VERTEX]->nDomains, NULL, (void**)&self->data, variable_Register ); Memory_Free( tmpName ); self->fieldComponentCount = 1; tmpName = Stg_Object_AppendSuffix( self, (Name)"DofLayout" ); self->dofLayout = DofLayout_New( tmpName, self->context, variable_Register, ((IGraph*)self->feMesh->topo)->remotes[MT_VERTEX]->nDomains, NULL ); DofLayout_AddAllFromVariableArray( self->dofLayout, 1, &self->dataVariable ); Memory_Free( tmpName ); self->eqNum->dofLayout = self->dofLayout; _ParticleFeVariable_Build( self, data ); }
void _NonNewtonianAbs_Build( void* _self, void* data ){ NonNewtonianAbs* self = (NonNewtonianAbs*)_self; _Rheology_Build( self, data ); Stg_Component_Build( self->strainRateInvField, data, False ); }
void Stg_ComponentFactory_BuildComponents( Stg_ComponentFactory* self, void* data ) { Stg_Component* component = NULL; Index component_I; Stream* stream; assert( self ); stream = self->infoStream; if( self->componentDict ){ Journal_Printf( stream, "\nBuilding Stg_Components from the live-component register\n\n" ); Stream_Indent( stream ); for( component_I = 0; component_I < LiveComponentRegister_GetCount( self->LCRegister ); component_I++ ){ /* Grab component from register */ component = LiveComponentRegister_At( self->LCRegister, component_I ); if( component && !component->isBuilt ){ Stg_Component_Build( component, data, True ); } } Stream_UnIndent( stream ); } else{ Journal_Printf( stream, "No Stg_ComponentList found..!\n" ); } }
void ElementCellLayoutSuite_Setup( ElementCellLayoutSuiteData* data ) { Journal_Enable_AllTypedStream( False ); /* MPI Initializations */ data->comm = MPI_COMM_WORLD; MPI_Comm_rank( data->comm, &data->rank ); MPI_Comm_size( data->comm, &data->nProcs ); data->nDims = 3; data->meshSize[0] = 2; data->meshSize[1] = 3; data->meshSize[2] = 2; data->minCrds[0] = 0.0; data->minCrds[1] = 0.0; data->minCrds[2] = 0.0; data->maxCrds[0] = 300.0; data->maxCrds[1] = 12.0; data->maxCrds[2] = 300.0; /* Init mesh */ data->extensionMgr_Register = ExtensionManager_Register_New(); data->mesh = ElementCellLayout_BuildMesh( data->nDims, data->meshSize, data->minCrds, data->maxCrds, data->extensionMgr_Register ); /* Configure the element-cell-layout */ data->elementCellLayout = ElementCellLayout_New( "elementCellLayout", NULL, data->mesh ); Stg_Component_Build( data->elementCellLayout, NULL, False ); Stg_Component_Initialise( data->elementCellLayout, NULL, False ); }
void _SwarmDump_Build( void* swarmDump, void* data ) { SwarmDump* self = (SwarmDump*) swarmDump; Index swarm_I; for ( swarm_I = 0 ; swarm_I < self->swarmCount ; swarm_I++ ) { Stg_Component_Build( self->swarmList[ swarm_I ], data, False ); } }
void _PETScMGSolver_Build( void* matrixSolver, void* data ) { PETScMGSolver* self = (PETScMGSolver*)matrixSolver; assert( self && Stg_CheckType( self, PETScMGSolver ) ); if( self->opGen ) Stg_Component_Build( self->opGen, data, False ); }
void _StokesBlockKSPInterface_Build( void* solver, void* sle ) {/* it is the sle here being passed in*/ StokesBlockKSPInterface* self = (StokesBlockKSPInterface*)solver; Stream_IndentBranch( StgFEM_Debug ); /* Build Preconditioner */ if ( self->preconditioner ) { Stg_Component_Build( self->preconditioner, sle, False ); SystemLinearEquations_AddStiffnessMatrix( self->st_sle, self->preconditioner ); } if( self->mg ){ Stg_Component_Build( self->mg, sle, False ); } Stream_UnIndentBranch( StgFEM_Debug ); }
void _Underworld_Mobility_Build( void* component, void* data ) { Underworld_Mobility* self = (Underworld_Mobility*)component; assert( self ); Stg_Component_Build( self->velocitySquaredField, data, False ); _Codelet_Build( self, data ); }
void _DruckerPrager_Build( void* rheology, void* data ) { DruckerPrager* self = (DruckerPrager*) rheology; /* Build parent */ _VonMises_Build( self, data ); Stg_Component_Build( self->tensileFailure, data, False ); }
void _Remesher_Build( void* remesher, void* data ) { Remesher* self = (Remesher*)remesher; assert( self ); assert( self->mesh ); /*Stg_Component_Build( self->remeshFunc, data, False );*/ Stg_Component_Build( self->mesh, data, False ); }