void _VariableCondition_Build( void* variableCondition, void* data ) {
	VariableCondition*				self = (VariableCondition*)variableCondition;
	VariableCondition_ValueIndex	val_I;
	Index									i;
	
	/* Read the dictionary */
	self->_readDictionary( self, self->dictionary );
	
	/* Obtain the set */
	self->_set = self->_getSet(self);
	if (self->_set)
		IndexSet_GetMembers(self->_set, &self->indexCount, &self->indexTbl);
	else {
		self->indexCount = 0;
		self->indexTbl = NULL;
	}
	
	/* Only build the index related tables if there are active BCs */
	if ( self->indexCount ) {
		/* Build the variable to condition table */
		self->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, self->indexCount, "VC->vcVarCountTbl" );
		
		for (i = 0; i < self->indexCount; i++) {
			/* For the index, get the number of "variables" that have been assigned conditions */
			self->vcVarCountTbl[i] = self->_getVariableCount(self, self->indexTbl[i]);
		}

		self->vcTbl = Memory_Alloc_2DComplex( VariableCondition_Tuple, self->indexCount, self->vcVarCountTbl, "VC->vcTbl" );
		for ( i = 0; i < self->indexCount; i++ ) {
			VariableCondition_VariableIndex vcVar_I;

			for ( vcVar_I = 0; vcVar_I < self->vcVarCountTbl[i]; vcVar_I++ ) {
				Variable* var;

				/* For the index's variable, get the variable i.d. and value i.d. */
				self->vcTbl[i][vcVar_I].varIndex = self->_getVariableIndex(self, self->indexTbl[i], vcVar_I);
				self->vcTbl[i][vcVar_I].valIndex = self->_getValueIndex(self, self->indexTbl[i], vcVar_I);

				/* Force the building of the variable (to be safe) */
				var = self->variable_Register->_variable[self->vcTbl[i][vcVar_I].varIndex];
				Stg_Component_Build( var, data, False );
			}
		}
	}	

	self->valueCount = self->_getValueCount(self);
	self->valueTbl = Memory_Alloc_Array( VariableCondition_Value, self->valueCount, "VC->valueTbl" );
	for (val_I = 0; val_I < self->valueCount; val_I++)
		self->valueTbl[val_I] = self->_getValue(self, val_I);

	/* Build mapping. */
	self->mapping = UIntMap_New();
	for( i = 0; i < self->indexCount; i++ )
		UIntMap_Insert( self->mapping, self->indexTbl[i], i );
}
示例#2
0
Mesh* _Mesh_New(  MESH_DEFARGS  ) {
	Mesh* self;
	
	/* Allocate memory */
	assert( _sizeOfSelf >= sizeof(Mesh) );
	self = (Mesh*)_Stg_Component_New(  STG_COMPONENT_PASSARGS  );

	self->topo = (MeshTopology*)IGraph_New( "" );
	self->vertices = NULL;
    self->verticesVariable = NULL;
    self->vGlobalIdsVar = NULL;
    self->verticesgid = NULL;
    self->e_n = NULL;
    self->enMapVar = NULL;
    self->elgid = NULL;
    self->eGlobalIdsVar = NULL;

	self->vars = List_New();
	List_SetItemSize( self->vars, sizeof(MeshVariable*) );

	self->minSep = 0.0;
	self->minAxialSep = NULL;
	self->minLocalCrd = NULL;
	self->maxLocalCrd = NULL;
	self->minDomainCrd = NULL;
	self->maxDomainCrd = NULL;
	self->minGlobalCrd = NULL;
	self->maxGlobalCrd = NULL;

	self->algorithms = Mesh_Algorithms_New( "", NULL );
	Mesh_Algorithms_SetMesh( self->algorithms, self );
	self->nElTypes = 0;
	self->elTypes = NULL;
	self->elTypeMap = NULL;

	self->topoDataSizes = UIntMap_New();
	self->topoDataInfos = NULL;
	self->topoDatas = NULL;
	self->info = ExtensionManager_New_OfExistingObject( "mesh_info", self );
	self->vertGridId = (unsigned)-1;
	self->elGridId = (unsigned)-1;
	self->periodicId = (unsigned)-1;
	self->localOriginId = (unsigned)-1;
	self->localRangeId = (unsigned)-1;

	self->generator = NULL;
	self->emReg = NULL;

	self->isDeforming     = False;

	self->isRegular = False;
    self->parentMesh = NULL;

	return self;
}
示例#3
0
Bool testAll( unsigned rank, unsigned nProcs, unsigned watch ) {
	Bool		result = True;
	DecompTransfer*	transfer;
	Decomp*		decomps[2];
	UIntMap*	map;
	unsigned	nLocals[2];
	unsigned*	locals[2];
	unsigned	l_i, ind_i;

	nLocals[0] = 10;
	locals[0] = Memory_Alloc_Array_Unnamed( unsigned, nLocals[0] );
	for( l_i = 0; l_i < nLocals[0]; l_i++ )
		locals[0][l_i] = rank * nLocals[0] + l_i;

	decomps[0] = Decomp_New( "" );
	Decomp_SetLocals( decomps[0], nLocals[0], locals[0] );

	nLocals[1] = 10;
	locals[1] = Memory_Alloc_Array_Unnamed( unsigned, nLocals[1] );
	for( l_i = 0; l_i < nLocals[0]; l_i++ )
		locals[1][l_i] = (nProcs - rank - 1) * nLocals[1] + l_i;

	decomps[1] = Decomp_New( "" );
	Decomp_SetLocals( decomps[1], nLocals[1], locals[1] );

	map = UIntMap_New();
	for( ind_i = 0; ind_i < nLocals[0]; ind_i++ )
		UIntMap_Insert( map, Decomp_GlobalToLocal( decomps[0], locals[0][ind_i] ), locals[1][ind_i] );

	transfer = DecompTransfer_New( "" );
	DecompTransfer_SetDecomps( transfer, decomps[0], decomps[1], map );

	if( rank == watch ) {
	}

done:
	FreeObject( transfer );

	return result;
}