void _ModulesManager_Print( void* modulesManager, Stream* stream ) {
   ModulesManager* self = (ModulesManager*)modulesManager;
   Index           i;
   
   /* General info */
   Journal_Printf( (void*) stream, "%s (ptr): %p\n", ModulesManager_Type, self );
   
   /* Print parent */
   _Stg_Class_Print( self, stream );

   if( moduleDirectories->count > 0 ) {
      Journal_Printf( stream, "Search Path:\n" );
      Stream_Indent( stream );

      for( i = 0; i < moduleDirectories->count; ++i ) {
         Journal_Printf( stream, "(path) %s\n", Stg_ObjectList_ObjectAt( moduleDirectories, i ) );
      }
      Stream_UnIndent( stream );
   }

   if( self->modules->count > 0 ) {
      Journal_Printf( stream, "Loaded modules:\n" );
      Stream_Indent( stream );

      for( i = 0; i < self->modules->count; ++i ) {
         Module* module = (Module*)Stg_ObjectList_At( self->modules, i );
         Journal_Printf( stream, "%s\n", module->name );
      }
      Stream_UnIndent( stream );
   }
}
void _LinkedDofInfo_Print( void* linkedDofInfo, Stream* stream ) {
	LinkedDofInfo*	self = (LinkedDofInfo*)linkedDofInfo;
	Index				dofSet_I = 0;
	Node_Index		node_I = 0;
	Dof_Index		nodeLocalDof_I = 0;
	
	/* General info */
	Journal_Printf( stream, "LinkedDofInfo (ptr): %p\n", self );
	
	/* Print parent */
	_Stg_Class_Print( self, stream );

	Journal_Printf( stream, "%d Linked dof sets active:\n", self->linkedDofSetsCount );
	Stream_Indent( stream );

	for ( dofSet_I = 0; dofSet_I < self->linkedDofSetsCount; dofSet_I++ ) {
		Journal_Printf( stream, "Set %u: has eqNum %d\n", dofSet_I, self->eqNumsOfLinkedDofs[dofSet_I] );
	}
	Stream_UnIndent( stream );

	Journal_Printf( stream, "Linked dof sets table:\n", self->linkedDofSetsCount );
	Stream_Indent( stream );

	for ( node_I = 0; node_I < self->dofLayout->_numItemsInLayout; node_I++ ) {
		Journal_Printf( stream, "Node %d: ", node_I );
		for ( nodeLocalDof_I = 0; nodeLocalDof_I < self->dofLayout->dofCounts[node_I]; nodeLocalDof_I++ ) {
			Journal_Printf( stream, "%d, ", self->linkedDofTbl[node_I][nodeLocalDof_I] );
		}
		Journal_Printf( stream, "\n" );
	}
	Stream_UnIndent( stream );
}
Ejemplo n.º 3
0
Stg_Component* _Stg_ComponentFactory_ConstructByName( void* cf, Name componentName, Type type, Bool isEssential, void* data ) {
   Stg_ComponentFactory*   self              = (Stg_ComponentFactory*)cf;
   Stg_Component*      component;
   Stream*         stream            = self->infoStream;

   Journal_PrintfL( stream, 2, "Looking for %sessential component '%s': ", (isEssential ? "" : "non-"), componentName );

   component = LiveComponentRegister_Get( self->LCRegister, componentName );

   /* Checking */
   if (component) {
      Journal_PrintfL( stream, 2, "Found.\n" );

      if ( !component->isConstructed ) {
         /* Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentName ); */
         Stream_Indent( stream );
         Stg_Component_AssignFromXML( component, self, data, True );
         Stream_UnIndent( stream );
      }

      Stg_Class_CheckType( component, type );

   }
   else {
      Name         redirect;

      /* If we can find the component's name in the root dictionary, use that value instead. */
      if( self->rootDict ) {
         redirect = Dictionary_GetString_WithDefault( self->rootDict, componentName, "" );
         if( strcmp( redirect, "" ) ) {
            componentName = redirect;
            return self->constructByName( self, componentName, type, isEssential, data );
         }
      }

      Journal_PrintfL( stream, 2, "Not found.\n" );

      if ( isEssential ) {
         Stream* errorStream = Journal_Register( Error_Type, self->type );

         Journal_Printf( errorStream, "In func %s: Cannot find essential component '%s'.\n", __func__, componentName );

         Journal_Printf( errorStream, "Could you have meant one of these?\n" );

         Stream_Indent( errorStream );
         LiveComponentRegister_PrintSimilar( self->LCRegister, componentName, errorStream, 5 );
         Journal_Firewall( 0, errorStream, "" );
      }
   }
   
   return component;
}
void Materials_Register_AssignParticleProperties( 
		void*                   materialRegister,
		MaterialPointsSwarm*    swarm,
		Variable_Register*      variableRegister )
{
	Materials_Register* self               = (Materials_Register*)materialRegister;
	Material*           material;
	Particle_Index      lParticle_I;
	Particle_Index      particleLocalCount = swarm->particleLocalCount;
	Particle_Index      particleGlobalCount = 0;
	Stream*             stream = Journal_Register( Info_Type, (Name)self->type  );
	Processor_Index     formerStreamPrintingRank;
	double              setupStartTime = 0;
	double              setupTime = 0, tmin, tmax;
	Bool                firstStatusPrint = True;

        formerStreamPrintingRank = Stream_GetPrintingRank( stream );
        Stream_SetPrintingRank( stream, 0 );

	Journal_Printf( stream, "In func %s(): for swarm \"%s\"\n", __func__, swarm->name );
	Stream_Indent( stream );
	setupStartTime = MPI_Wtime();
	MPI_Reduce( &particleLocalCount, &particleGlobalCount, 1, MPI_UNSIGNED, MPI_SUM, 0, swarm->comm );
	Journal_Printf( stream, "Assigning initial particle properties to the %u global particles\n",
		particleGlobalCount );
	Stream_Indent( stream );

	for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) {
		material = MaterialPointsSwarm_GetMaterialAt( swarm, lParticle_I );

		if ( material ) {
			/* Loop through material's dictionary assigning values to the variables of this particle */
			Variable_Register_SetAllVariablesFromDictionary( variableRegister, lParticle_I, material->dictionary );
		}

		_Materials_Register_PrintParticleAssignUpdate( self, swarm, lParticle_I, stream, &firstStatusPrint );
	}

	Stream_UnIndent( stream );
	/* Need this barrier so the time is accurate */
	MPI_Barrier( swarm->comm );
	setupTime = MPI_Wtime() - setupStartTime;

	Stream_UnIndent( stream );

	MPI_Reduce( &setupTime, &tmin, 1, MPI_DOUBLE, MPI_MIN, 0, swarm->comm );
	MPI_Reduce( &setupTime, &tmax, 1, MPI_DOUBLE, MPI_MAX, 0, swarm->comm );
	Journal_Printf( stream, "%s(): finished setup of material properties for swarm \"%s\"\n"
		"\ttook %g [min] / %g [max] secs\n", __func__, swarm->name, tmin, tmax );
	Stream_SetPrintingRank( stream, formerStreamPrintingRank );
}
Ejemplo n.º 5
0
void CheckDictionaryKeys( Dictionary* dictionary, char* errorMessage)
{
	Dictionary_Index index_I, index_J;
	/* Put in the Journal_Firewall stream */
	Stream* errStream = Journal_Register( Error_Type, "DictionaryCheck");
	int errCount;
	int** keyIndexArray;


	keyIndexArray = Memory_Alloc_2DArray( int, ((dictionary->count)*(dictionary->count - 1)), 
					2, "Key Index Array" );
	/* Iterate through the whole dictionary*/
	errCount = 0;
	for ( index_I = 0; index_I < dictionary->count; ++index_I )
	{
		/*For Each key, search through dictionary to see if there is another 
		key the same*/
		for (index_J = index_I+1; index_J < dictionary->count; ++index_J ) {
			if (index_J != index_I)
			{
				/* If there are two keys with the same name */
				if ( (0 == strcasecmp( dictionary->entryPtr[index_I]->key, 
					dictionary->entryPtr[index_J]->key)) )
				{

					//preserve indexes index_I, index_J
					keyIndexArray[errCount][0] = index_I;
					keyIndexArray[errCount][1] = index_J;					
					//increment counter
					errCount++;
					
				}
			}
			
		}
	}
	/*if keyIndexArray is not empty, then do a print to error stream 
	for each problem then call Journal_Firewall */
	

	if (errCount > 0) {
		Index errIndex;
		Journal_Printf(errStream, errorMessage);
		Journal_Printf(errStream,"Error found in dictionary (ptr) %p:\n",dictionary);
		Journal_Printf(errStream,"The following keys were repeated:\n");
		Stream_Indent(errStream);
		for (errIndex = 0; errIndex < errCount; errIndex++) {

			Journal_Printf(errStream, "\"%s\"\n",					 
				dictionary->entryPtr[keyIndexArray[errIndex][1]]->key );
		}
		//Do I need this one here if Journal_Firewall exits prog?
		Stream_UnIndent(errStream);
		Journal_Firewall(errCount == 0, errStream, 
					"Error in %s with %d entries in dictionary keys\n",
					__func__, errCount);
		
	}
	Memory_Free(keyIndexArray);
}
Ejemplo n.º 6
0
void _Stg_ObjectAdaptor_Print( void* objectAdaptor, struct Stream* stream ) {
	Stg_ObjectAdaptor*	self = (Stg_ObjectAdaptor*)objectAdaptor;
	
	/* General info */
	Journal_Printf( stream, "Stg_ObjectAdaptor (ptr): %p\n", self );
	Stream_Indent( stream );
	
	_Stg_Object_Print( self, stream );
	
	Journal_Printf( stream, "iOwn: %s\n", self->iOwn ? "Yes" : "No" );
	Journal_Printf( stream, "isGlobal: %s\n", self->isGlobal ? "Yes" : "No" );
	Journal_Printf( stream, "isStgClass: %s\n", self->isStgClass ? "Yes" : "No" );
	
	if( self->isStgClass ) {
		Stg_Class_Print( self->dataPtr, stream );
	}
	else {
		if( self->ptrPrint ) {
			self->ptrPrint( self->dataPtr, stream );
		}
		else {
			Journal_Printf( stream, "Don't know how to print the pointer (it is not to a StGermain class)\n" );
		}
	}
	
	Stream_UnIndent( stream );
}
void _SphericalGenerator_GenElementTypes( void* meshGenerator, Mesh* mesh )
{
   SphericalGenerator*	self = (SphericalGenerator*)meshGenerator;
   Stream*			stream;
   unsigned		nDomainEls;
   unsigned		e_i;

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

   stream = Journal_Register( Info_Type, (Name)self->type  );
   Journal_Printf( stream, "Generating element types...\n" );
   Stream_Indent( stream );

   mesh->nElTypes = 1;
   mesh->elTypes = Memory_Alloc_Array( Mesh_ElementType*, mesh->nElTypes, "Mesh::elTypes" );
   mesh->elTypes[0] = (Mesh_ElementType*)Mesh_HexType_New();
   Mesh_ElementType_SetMesh( mesh->elTypes[0], mesh );
   nDomainEls = Mesh_GetDomainSize( mesh, Mesh_GetDimSize( mesh ) );
   mesh->elTypeMap = Memory_Alloc_Array( unsigned, nDomainEls, "Mesh::elTypeMap" );
   for( e_i = 0; e_i < nDomainEls; e_i++ )
      mesh->elTypeMap[e_i] = 0;

   Mesh_SetAlgorithms( mesh, Mesh_SphericalAlgorithms_New( "", NULL ) );

   MPI_Barrier( self->mpiComm );
   Journal_Printf( stream, "... element types are '%s',\n", mesh->elTypes[0]->type );
   Journal_Printf( stream, "... mesh algorithm type is '%s',\n", mesh->algorithms->type );
   Journal_Printf( stream, "... done.\n" );
   Stream_UnIndent( stream );
}
Ejemplo n.º 8
0
void _lucViewport_Print( void* viewport, Stream* stream )
{
   lucViewport*          self        = viewport;

   Journal_Printf( stream, "lucViewport: %s\n", self->name );

   Stream_Indent( stream );

   /* Print Parent */
   _Stg_Component_Print( self, stream );

   lucDrawingObject_Register_PrintAllObjects( self->drawingObject_Register, stream );

   Stg_Class_Print( self->camera, stream );

   Journal_PrintValue( stream, self->margin );
   Journal_PrintValue( stream, self->nearClipPlane );
   Journal_PrintValue( stream, self->farClipPlane );

   Journal_PrintString( stream, self->title );
   Journal_PrintBool( stream, self->timestep );
   Journal_PrintBool( stream, self->disabled );

   Stream_UnIndent( stream );
}
Ejemplo n.º 9
0
void Stg_ComponentFactory_DestroyComponents( 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, "\nDestroying 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->isDestroyed ){
            Stg_Component_Destroy( component, data, True );
         }
      }
      Stream_UnIndent( stream );
   }
   else{
      Journal_Printf( stream, "No Stg_ComponentList found..!\n" );
   }
}
Ejemplo n.º 10
0
/* Print implementation */
void _Stg_ObjectList_Print( void* objectList, struct Stream* stream ) {
   Stg_ObjectList* self = (Stg_ObjectList*) objectList;

   /* General info */
   Journal_Printf( stream, "Stg_ObjectList (ptr):%p\n", (void*)self );
   Stream_Indent( stream );
   
   /* Print parent class */
   _Stg_Class_Print( self, stream );

   /* Virtual info */
   Journal_Printf( stream, "_append(func ptr): %p\n", (void*)self->_append );
   Journal_Printf( stream, "_prepend(func ptr): %p\n", (void*)self->_prepend );
   Journal_Printf( stream, "_replaceAll(func ptr): %p\n", (void*)self->_replaceAll );
   Journal_Printf( stream, "_replace(func ptr): %p\n", (void*)self->_replace );
   Journal_Printf( stream, "_insertBefore(func ptr): %p\n", (void*)self->_insertBefore );
   Journal_Printf( stream, "_insertAfter(func ptr): %p\n", (void*)self->_insertAfter );
   Journal_Printf( stream, "_remove(func ptr): %p\n", (void*)self->_remove );
   Journal_Printf( stream, "_getIndex(func ptr): %p\n", (void*)self->_getIndex );
   Journal_Printf( stream, "_get(func ptr): %p\n", (void*)self->_get );
   Journal_Printf( stream, "_allocMoreMemory(func ptr): %p\n", (void*)self->_allocMoreMemory );
   Journal_Printf( stream, "_insertAtIndex(func ptr): %p\n", (void*)self->_insertAtIndex );
   Journal_Printf( stream, "_removeByIndex(func ptr): %p\n", (void*)self->_removeByIndex );
   Journal_Printf( stream, "_deleteAllObjects(func ptr): %p\n", (void*)self->_deleteAllObjects );

   /* Stg_ObjectList */
   Journal_Printf( stream, "_size: %u\n", self->_size );
   Journal_Printf( stream, "_delta: %u\n", self->_delta );
   Journal_Printf( stream, "_noJournalingInCopy: %u\n", self->_noJournalingInCopy );
   Journal_Printf( stream, "count: %u\n", self->count );
   Journal_Printf( stream, "data[0-%d]:\n", self->count );
   Stg_ObjectList_PrintAllObjects( self, stream );
   
   Stream_UnIndent( stream );
}
Ejemplo n.º 11
0
Stg_Component* _Stg_ComponentFactory_ConstructByNameWithKeyFallback( 
   void*         cf, 
   Name          parentComponentName, 
   Name                 componentTrialName, 
   Dictionary_Entry_Key fallbackKey, 
   Type         type, 
   Bool         isEssential,
   void*         data ) 
{
   Stg_ComponentFactory*   self              = (Stg_ComponentFactory*)cf;
   Stg_Component*      component;
   Stream*         stream            = self->infoStream;

   Journal_PrintfL( stream, 2, "First Trying to find component by name '%s': ", componentTrialName );
   component = LiveComponentRegister_Get( self->LCRegister, componentTrialName );
   
   if (component) {
      Journal_PrintfL( stream, 2, "Found.\n" );

      if ( !component->isConstructed ) {
         Journal_Printf( stream, "%s has not been constructed yet. Constructing now.\n", componentTrialName );
         Stream_Indent( stream );
         Stg_Component_AssignFromXML( component, self, data, True );
         Stream_UnIndent( stream );
      }
   }
   else {
      Journal_PrintfL( stream, 2, "Not found.\n" );
      Journal_PrintfL( stream, 2, "Fallback - Trying to find component by key '%s'.\n", fallbackKey );

      component = self->constructByKey( self, parentComponentName, fallbackKey, type, isEssential, data );
   }
      
   return component;
}
void _FieldVariable_Print( void* _fieldVariable, Stream* stream ) {
   FieldVariable* self = (FieldVariable*) _fieldVariable;

   Journal_Printf( stream, "FieldVariable - '%s'\n", self->name );
   Stream_Indent( stream );
   _Stg_Component_Print( self, stream );

   Journal_PrintPointer( stream, self->_interpolateValueAt );
   Journal_PrintPointer( stream, self->_getMinGlobalFieldMagnitude );
   Journal_PrintPointer( stream, self->_getMaxGlobalFieldMagnitude );
   Journal_PrintPointer( stream, self->_cacheMinMaxGlobalFieldMagnitude );
   Journal_PrintPointer( stream, self->_getMinAndMaxLocalCoords );
   Journal_PrintPointer( stream, self->_getMinAndMaxGlobalCoords );

   Journal_PrintValue( stream, self->fieldComponentCount );
   Journal_PrintValue( stream, self->dim );
   Journal_PrintBool( stream, self->isCheckpointedAndReloaded);
   #ifdef LAM_MPI
      Journal_PrintPointer( stream, self->communicator );
   #elif  defined( OPEN_MPI )
      Journal_PrintPointer( stream, self->communicator );
   #else
      Journal_PrintValue( stream, self->communicator );
   #endif
   Journal_PrintPointer( stream, self->fieldVariable_Register );
   Stream_UnIndent( stream );
}
Ejemplo n.º 13
0
void _SwarmDump_Execute( void* swarmDump, void* data ) {
	SwarmDump*	      self                = (SwarmDump*)     swarmDump;
	AbstractContext*  context             = Stg_CheckType( data, AbstractContext );
	Stream*           stream              = Journal_Register( MPIStream_Type, Swarm_Type );
	Particle_Index    particleLocalCount;
	SizeT             particleSize;
	Name              filename;
	Index             swarm_I;
	Swarm*            swarm;
	Stream*           info = Journal_Register( Info_Type, self->type );
	Processor_Index   rank_I;

	Journal_DPrintf( info, "Proc %d: beginning Swarm binary checkpoint in %s():\n", self->swarmList[0]->myRank, __func__ );
	Stream_Indent( info );
	
	for ( swarm_I = 0 ; swarm_I < self->swarmCount ; swarm_I++ ) {
		swarm = self->swarmList[ swarm_I ];
		particleLocalCount = swarm->particleLocalCount;
		particleSize = (SizeT) swarm->particleExtensionMgr->finalSize;

		if ( self->newFileEachTime ) {
			if ( strlen(context->checkPointPrefixString) > 0 ) {
				Stg_asprintf( &filename, "%s/%s.%s.%05d.dat", context->outputPath,
					context->checkPointPrefixString, swarm->name, context->timeStep );
			}
			else {
				Stg_asprintf( &filename, "%s/%s.%05d.dat", context->outputPath,
					swarm->name, context->timeStep );
			}
		}	
		else { 
			if ( strlen(context->checkPointPrefixString) > 0 ) {
				Stg_asprintf( &filename, "%s/%s.%s.dat", context->outputPath,
					context->checkPointPrefixString, swarm->name );
			}
			else {
				Stg_asprintf( &filename, "%s/%s.dat", context->outputPath, swarm->name );
			}
		}	

		for ( rank_I = 0; rank_I < swarm->nProc; rank_I++ ) {
			if ( swarm->myRank == rank_I ) {
				Journal_DPrintf( info, "Proc %d: for swarm \"%s\", dumping its %u particles of size %u bytes "
					"each (= %g bytes total) to file %s\n", swarm->myRank, swarm->name, particleLocalCount,
					particleSize, (float)(particleLocalCount * particleSize), filename );
			}	
			MPI_Barrier( swarm->comm );
		}

		Stream_RedirectFile( stream, filename );

		MPIStream_WriteAllProcessors( stream, swarm->particles, particleSize, (SizeT) particleLocalCount, swarm->comm );

		Stream_CloseFile( stream );
		Memory_Free( filename );
	}
	Stream_UnIndent( info );
	Journal_DPrintf( info, "Proc %d: finished Swarm binary checkpoint.\n", self->swarmList[0]->myRank );
}
void _OneToOneMapper_Print( void* mapper, Stream* stream ) {
	OneToOneMapper* self = (OneToOneMapper*)mapper;
	
	_IntegrationPointMapper_Print( self, stream );
	Stream_Indent( stream );
	Stg_Class_Print( self->materialSwarm, stream );
	Stream_UnIndent( stream );
}
Ejemplo n.º 15
0
void _Toolbox_Print( void* toolbox, Stream* stream ) {
	Toolbox* self = (Toolbox*)toolbox;

	Journal_Printf( stream, "Toolbox: %s\n", self->name );
	Stream_Indent( stream );
	
	/* Print parent */
	_Module_Print( self, stream );
	
	Stream_UnIndent( stream );
}
Ejemplo n.º 16
0
void _Plugin_Print( void* plugin, Stream* stream ) {
    Plugin* self = (Plugin*)plugin;

    Journal_Printf( stream, "Plugin: %s\n", self->name );
    Stream_Indent( stream );

    /* Print parent */
    _Module_Print( self, stream );

    Stream_UnIndent( stream );
}
Ejemplo n.º 17
0
void Dictionary_Entry_Value_Print( Dictionary_Entry_Value* self, Stream* stream ) {
	Dictionary_Index index;
	
	if( !self ) {
		return;
	}
	
	switch( self->type ) {
		case Dictionary_Entry_Value_Type_String:
			Journal_Printf( stream, "\"%s\"", self->as.typeString );
			return;
		case Dictionary_Entry_Value_Type_Double:
			Journal_Printf( stream, "%g", self->as.typeDouble );
			return;
		case Dictionary_Entry_Value_Type_UnsignedInt:
			Journal_Printf( stream, "%u", self->as.typeUnsignedInt );
			return;
		case Dictionary_Entry_Value_Type_Int:
			Journal_Printf( stream, "%d", self->as.typeInt );
			return;
		case Dictionary_Entry_Value_Type_UnsignedLong:
			Journal_Printf( stream, "%ld", self->as.typeUnsignedLong );
			return;
		case Dictionary_Entry_Value_Type_Bool:
			Journal_Printf( stream, "%s", Dictionary_Entry_Value_AsString( self ) );
			return;
		case Dictionary_Entry_Value_Type_List:
			if (self->as.typeList->first) {
				Dictionary_Entry_Value* cur = self->as.typeList->first;
				Dictionary_Entry_Value_Print( cur, stream );
				cur = cur->next;
				
				while (cur) {
					Journal_Printf( stream, ", " );
					Dictionary_Entry_Value_Print( cur, stream );
					cur = cur->next;
				}
			}
			return;
		case Dictionary_Entry_Value_Type_Struct:
			Stream_Indent( stream );
			for( index = 0; index < self->as.typeStruct->count; index++ ) {
				Journal_Printf( stream, "\n");
				Journal_Printf( stream, "%s: ", self->as.typeStruct->entryPtr[index]->key );
				Dictionary_Entry_Value_Print( self->as.typeStruct->entryPtr[index]->value, stream );
			}
			Stream_UnIndent( stream );
			return;
		default: {
			Stream* errorStream = Journal_Register( Error_Type, "Dictionary_Entry_Value" );
			Journal_Firewall( False, errorStream, "In func %s: self->type '%d' is invalid.\n", __func__, self->type );
		}
	}
}
Ejemplo n.º 18
0
void _UnionParticleLayout_Print( void* unionParticleLayout, Stream* stream ) {
	UnionParticleLayout* self  = (UnionParticleLayout*)unionParticleLayout;
	
	/* General info */
	Journal_Printf( stream, "UnionParticleLayout (ptr): %p:\n", self );
	Stream_Indent( stream );
	
	/* Parent class info */
	_GlobalParticleLayout_Print( self, stream );
	
	/* UnionParticleLayout */
	
	Stream_UnIndent( stream );
}
Ejemplo n.º 19
0
void _SwarmDump_Print( void* _swarmDump, Stream* stream ) {
	SwarmDump* self = (SwarmDump*) _swarmDump;
	Index      swarm_I;

	Journal_Printf( stream, "SwarmDump - '%s'\n", self->name );
	Stream_Indent( stream );
	_Stg_Component_Print( self, stream );

	for ( swarm_I = 0 ; swarm_I < self->swarmCount ; swarm_I++ ) {
		Journal_Printf( stream, "Swarm - '%s'\n", self->swarmList[ swarm_I ]->name );
	}

	Stream_UnIndent( stream );
}
void _ManualParticleLayout_Print( void* manualParticleLayout, Stream* stream ) {
	ManualParticleLayout* self  = (ManualParticleLayout*)manualParticleLayout;
	
	/* General info */
	Journal_Printf( stream, "ManualParticleLayout (ptr): %p:\n", self );
	Stream_Indent( stream );
	
	/* Parent class info */
	_GlobalParticleLayout_Print( self, stream );
	
	/* ManualParticleLayout */
	
	Stream_UnIndent( stream );
}
void _NamedObject_Register_Print( void* namedObjectRegister, struct Stream* stream ) {
   NamedObject_Register* self = (NamedObject_Register*)namedObjectRegister;

   /* General info */
   Journal_Printf( stream, "NamedObject_Register (ptr): %p\n", self);
   Stream_Indent( stream );
   
   /* Use parent print */
   _Stg_Class_Print( self, stream );
   
   /* Print the list of registered objects */
   Stg_Class_Print( self->objects, stream );   
   
   Stream_UnIndent( stream );
}
void _VoxelDataHandler_Geomodeller_Print( void* voxelDataHandler, Stream* stream ) {
   VoxelDataHandler_Geomodeller* self = (VoxelDataHandler_Geomodeller*)voxelDataHandler;

   /* General info */
   Journal_Printf( stream, "VoxelDataHandler_Geomodeller (ptr): %p:\n", self );
   Stream_Indent( stream );

   /* Parent class info */
   _VoxelDataHandler_Abstract_Print( self, stream );

   /* VoxelDataHandler_Geomodeller */
   Journal_Printf( stream, "filename: %s\n", self->filename );

   Stream_UnIndent( stream );
}
Ejemplo n.º 23
0
void _FileParticleLayout_Print( void* particleLayout, Stream* stream ) {
	FileParticleLayout* self  = (FileParticleLayout*)particleLayout;
	
	/* General info */
	Journal_Printf( stream, "FileParticleLayout (ptr): %p:\n", self );
	Stream_Indent( stream );
	
	/* Parent class info */
	_GlobalParticleLayout_Print( self, stream );
	
	/* FileParticleLayout */
	Journal_Printf( stream, "filename: %s\n", self->filename );
	Journal_Printf( stream, "file (ptr): %p\n", self->file );
	
	Stream_UnIndent( stream );
}
Ejemplo n.º 24
0
void _Stg_Class_Print( void* _class, struct Stream* stream ) {
	Stg_Class* self = (Stg_Class*)_class;
	
	Journal_Firewall( (Bool)stream, stream, "Attempting to Print to stream that is NULL\n" );
	Journal_Firewall( (Bool)self, stream, "Attempting to Print class that is NULL\n" );
	
	Journal_Printf( stream, "Stg_Class (ptr): %p\n", self );
	Stream_Indent( stream );
	Journal_Printf( stream, "sizeOfSelf: %lu\n", self->_sizeOfSelf );
	Journal_Printf( stream, "_deleteSelf: %s\n", self->_deleteSelf ? "Yes" : "No" );
	Journal_Printf( stream, "type: %s\n", self->type == Type_Invalid ? "Invalid" : self->type );
	Journal_Printf( stream, "_delete (func ptr): %p\n", self->_delete );
	Journal_Printf( stream, "_print (func ptr): %p\n", self->_print );
	Journal_Printf( stream, "_copy (func ptr): %p\n", self->_copy );
	Stream_UnIndent( stream );
}
Ejemplo n.º 25
0
void _TimeIntegrand_Print( void* timeIntegrand, Stream* stream ) {
	TimeIntegrand* self = (TimeIntegrand*)timeIntegrand;

	/* General info */
	Journal_DPrintf( self->debug, "TimeIntegrand - '%s'\n", self->name );
	Journal_PrintPointer( stream, self );
	Stream_Indent( stream );
	
	/* Print parent */
	_Stg_Component_Print( self, stream );
	
	/* Virtual info */

	/* Regular Info */
	
	Stream_UnIndent( stream );
}
Ejemplo n.º 26
0
void _ConvexHull_AssignFromXML( void* convexHull, Stg_ComponentFactory* cf, void* data ) {
	ConvexHull*             self       = (ConvexHull*)convexHull;
	Index                   vertexCount;
	Index                   vertex_I;
	Coord_List              vertexList;
	double*                 coord;
	Dictionary_Entry_Value* optionSet;
	Dictionary_Entry_Value* optionsList;
	Dictionary*             dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
	Stream*                 stream     = cf->infoStream;

	
	_Stg_Shape_AssignFromXML( self, cf, data );

	optionsList = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"vertices"  );
	Journal_Firewall( optionsList != NULL, 
		Journal_Register( Error_Type, (Name)self->type  ),
		"In func %s: The list 'vertices' specifying the convexHull is NULL.\n", __func__);

	vertexCount = Dictionary_Entry_Value_GetCount(optionsList);
	Journal_Firewall( ( self->dim == 2 && vertexCount < 4 ) || ( self->dim == 3 && vertexCount < 5 ),
		Journal_Register( Error_Type, (Name)self->type  ),
		"In func %s: Sorry, but we got lazy, you can only specify 3 (2D) or 4 (3D) points. " 
		"Please feel free to hassle developers for this feature.\n", __func__);

	/* Allocate space */
	vertexList = Memory_Alloc_Array( Coord , vertexCount, "Vertex Array" );
	memset( vertexList, 0, vertexCount * sizeof(Coord) );
	
	Stream_Indent( stream );
	for ( vertex_I = 0 ; vertex_I < vertexCount ; vertex_I++) { 
		optionSet = Dictionary_Entry_Value_GetElement(optionsList, vertex_I );
		coord = vertexList[vertex_I];

		/* Read Vertex */
		coord[ I_AXIS ] = Dictionary_Entry_Value_AsDouble( Dictionary_Entry_Value_GetMember( optionSet, (Dictionary_Entry_Key)"x") );
		coord[ J_AXIS ] = Dictionary_Entry_Value_AsDouble( Dictionary_Entry_Value_GetMember( optionSet, (Dictionary_Entry_Key)"y") );
		
		coord[ K_AXIS ] = Dictionary_Entry_Value_AsDouble( Dictionary_Entry_Value_GetMember( optionSet, (Dictionary_Entry_Key)"z"));
		optionSet = optionSet->next;
	}
	Stream_UnIndent( stream  );


	_ConvexHull_Init( self, vertexList, vertexCount);
}
//void MultigridSolver_LevelCycle( MultigridSolver* self, unsigned levelInd, Vector* rhs, Vector* solution ) {
void MultigridSolver_LevelCycle( MultigridSolver* self, unsigned levelInd, Vec rhs, Vec solution ) {
	MultigridSolver_Level*	level;

	assert( self );
	assert( levelInd < self->nLevels );

	Stream_Indent( self->stream );
	level = self->levels + levelInd;

	if( level->nDownIts ) {
		Journal_Printf( self->stream, "Down-solve on level %d... ", levelInd );
		//MatrixSolver_Solve( level->downSolver, rhs, solution );
		//Journal_Printf( self->stream, "residual: %.10lf\n", MatrixSolver_GetResidualNorm( level->downSolver ) );
		KSPSolve( level->downSolver->ksp, rhs, solution );
		Journal_Printf( self->stream, "residual: %.10lf\n", _GetResidualNorm( level->downSolver ) );
	}

	if( levelInd > 0 ) {
		MultigridSolver_Level*	nextLevel;
		unsigned		c_i;

		nextLevel = self->levels + (levelInd - 1);
		if( level->R == level->P )
			//Matrix_TransposeMultiply( level->R, MatrixSolver_GetResidual( level->downSolver ), nextLevel->workRHS );
			MatMultTranspose( level->R, _GetResidual( level->downSolver ), nextLevel->workRHS );
		else
			//Matrix_Multiply( level->R, MatrixSolver_GetResidual( level->downSolver ), nextLevel->workRHS );
			MatMult( level->R, _GetResidual( level->downSolver ), nextLevel->workRHS );
		for( c_i = 0; c_i < level->nCycles; c_i++ )
			MultigridSolver_LevelCycle( self, levelInd - 1, nextLevel->workRHS, nextLevel->workSol );
		//Matrix_MultiplyAdd( level->P, nextLevel->workSol, solution, solution );
		MatMultAdd( level->P, nextLevel->workSol, solution, solution );
	}

	if( level->nUpIts ) {
		Journal_Printf( self->stream, "Up-solve on level %d... ", levelInd );
		//MatrixSolver_Solve( level->upSolver, rhs, solution );
		//Journal_Printf( self->stream, "residual: %.10lf\n", MatrixSolver_GetResidualNorm( level->upSolver ) );
		KSPSolve( level->upSolver->ksp, rhs, solution );
		Journal_Printf( self->stream, "residual: %.10lf\n", _GetResidualNorm( level->upSolver ) );
	}

	Stream_UnIndent( self->stream );
}
Ejemplo n.º 28
0
void _SwarmVariable_Print( void* _swarmVariable, Stream* stream ) {
	SwarmVariable* self = (SwarmVariable*) _swarmVariable;

	Journal_Printf( stream, "SwarmVariable - '%s'\n", self->name );
	Stream_Indent( stream );
	_Stg_Component_Print( self, stream );

	Journal_PrintPointer( stream, self->_valueAt );
	Journal_PrintPointer( stream, self->_getMinGlobalMagnitude );
	Journal_PrintPointer( stream, self->_getMaxGlobalMagnitude );

	Journal_Printf( stream, "Swarm - '%s'\n", self->swarm->name );
	if ( self->variable != NULL )
		Journal_Printf( stream, "Variable - '%s'\n", self->variable->name );

	Journal_PrintValue( stream, self->dofCount );
	Journal_PrintPointer( stream, self->swarmVariable_Register );
	Stream_UnIndent( stream );
}
Ejemplo n.º 29
0
void _ToolboxesManager_Print( void* toolboxesManager, Stream* stream ) {
    ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;

    /* General info */
    Journal_Printf( (void*) stream, "Toolboxes (ptr): %p\n", self );

    if( Stg_ObjectList_Count(self->initTB) > 0 ) {
        Index i;

        Journal_Printf( stream, "Initialised Modules:\n" );
        Stream_Indent( stream );
        for( i = 0; i < Stg_ObjectList_Count(self->initTB) ; ++i ) {
            Journal_Printf( stream, "%s\n", self->initTB->data[i]->name );
        }
        Stream_UnIndent( stream );
    }

    /* Print parent */
    _ModulesManager_Print( self, stream );
}
void _PeriodicBoundariesManager_Print( void* perBCsManager, Stream* stream ) {
	PeriodicBoundariesManager*	self = (PeriodicBoundariesManager*)perBCsManager;
	Index								perBoundary_I = 0;
	
	/* General info */
	Journal_Printf( stream, "PeriodicBoundariesManager (ptr): %p\n", self );
	
	/* Print parent */
	_Stg_Component_Print( self, stream );

	Journal_Printf( stream, "%d periodic boundaries registered: %p\n", self );
	Stream_Indent( stream );

	for ( perBoundary_I = 0; perBoundary_I < self->count; perBoundary_I++ ) {
		Journal_Printf( stream, "Boundary %d: Axis %d, Min=%f, Max=%f\n", perBoundary_I,
			self->boundaries[perBoundary_I].axis,
			self->boundaries[perBoundary_I].minWall,
			self->boundaries[perBoundary_I].maxWall );
	}
	Stream_UnIndent( stream );
}