/* Creation implementation */ Stg_ComponentFactory* _Stg_ComponentFactory_New( STG_COMPONENTFACTORY_DEFARGS ) { Stg_ComponentFactory *self = NULL; assert( _sizeOfSelf >= sizeof( Stg_ComponentFactory ) ); self = (Stg_ComponentFactory*) _Stg_Class_New( STG_CLASS_PASSARGS ); self->getDouble = getDouble; self->getInt = getInt; self->getUnsignedInt = getUnsignedInt; self->getBool = getBool; self->getString = getString; self->getRootDictDouble = getRootDictDouble; self->getRootDictInt = getRootDictInt; self->getRootDictUnsignedInt = getRootDictUnsignedInt; self->getRootDictBool = getRootDictBool; self->getRootDictString = getRootDictString; self->constructByName = constructByName; self->constructByKey = constructByKey; self->constructByNameWithKeyFallback = constructByNameWithKeyFallback; self->constructByList = constructByList; self->rootDict = rootDict; self->componentDict = componentDict; self->infoStream = Journal_Register( InfoStream_Type, self->type ); Stream_SetPrintingRank( self->infoStream, 0 ); Stream_SetAutoFlush( self->infoStream, True ); _Stg_ComponentFactory_Init( self ); return self; }
void Experimental_NodeTempProfile( PICelleratorContext* context ) { #if 0 static FeVariable* temperatureFe; FiniteElement_Mesh* mesh; double* nodeCoord; double lmaxTemp, nodeTemp; Index lNode_I, newNodeID; int startProfileNodeID; static Bool beenHere = False; Stream* stream = Journal_Register( Info_Type, (Name)"TempNodeHeight" ); char* filename; double* maxTempList = Memory_Alloc_Array( double, context->nproc, "Hold the max temperature of each array"); unsigned rootProc; rootProc = 0; if (!beenHere) { Name tempFeName; tempFeName = Dictionary_GetString_WithDefault( context->dictionary, "TemperatureField", "TemperatureField" ); /* Get TemperatureField FeVariable */ temperatureFe = (FeVariable*) LiveComponentRegister_Get( context->CF->LCRegister, (Name)tempFeName ); assert( temperatureFe ); /* Set up stream */ Stg_asprintf( &filename, "CylinderNodeProfiling.%dof%d.dat", context->rank, context->nproc ); Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, filename ); Memory_Free( filename ); Stream_SetAutoFlush( stream, True ); /* Print header to stream */ Journal_Printf( stream, "Timestep\tCentralPosition\t\tNodeTemperature\n" ); beenHere = True; } mesh = temperatureFe->feMesh; for( lNode_I = 0; lNode_I < temperatureFe->feMesh->nodeLocalCount ; lNode_I++ ) { nodeTemp = FeVariable_GetScalarAtNode( temperatureFe , lNode_I ); if( lNode_I == 0 ) { lmaxTemp = nodeTemp; startProfileNodeID = lNode_I; } if ( nodeTemp > lmaxTemp ) { lmaxTemp = nodeTemp; startProfileNodeID = lNode_I; } } MPI_Gather( &lmaxTemp, 1, MPI_DOUBLE, maxTempList, 1, MPI_DOUBLE, rootProc, context->communicator ); Journal_Printf( stream, "%.6g ******************************\n", (double)context->timeStep ); nodeCoord = Mesh_CoordAt( mesh , startProfileNodeID ); nodeTemp = FeVariable_GetScalarAtNode( temperatureFe, startProfileNodeID ); Journal_Printf( stream, "\t\tNode Profile in Y direction, starting at (%.6g, %.6g, %.6g)\tat temperature = %g\n", nodeCoord[0], nodeCoord[1], nodeCoord[2], nodeTemp ); newNodeID = mesh->nodeNeighbourTbl[ startProfileNodeID ][ 1 ]; /* 1 = +y direction, 2 = +z direction */ if( newNodeID >= mesh->nodeLocalCount ) { /* is node NOT a local, thus stop profiling */ Journal_Printf( stream, "\t\tProfiling has reached the boundary of the local processor\n"); } else { /* continue profiling */ nodeTemp = FeVariable_GetScalarAtNode( temperatureFe, newNodeID ); while( nodeTemp > 0.0 ) { nodeCoord = Mesh_CoordAt( mesh, newNodeID ); Journal_Printf( stream, "\t\t (%.6g, %.6g, %.6g)\tat temperature = %g\n", nodeCoord[0], nodeCoord[1], nodeCoord[2], nodeTemp ); newNodeID = mesh->nodeNeighbourTbl[ newNodeID ][ 1 ]; if( newNodeID >= mesh->nodeLocalCount ) { /* is node not a local i.e. not on processor, tus stop profiling */ Journal_Printf( stream, "\t\tProfiling has reached the boundary of the local processor\n"); break; } nodeTemp = FeVariable_GetScalarAtNode( temperatureFe, newNodeID ); } } Memory_Free( maxTempList ); MPI_Barrier( context->communicator ); #endif }