void Mesh_SetTopologyDataSize( void* mesh, MeshTopology_Dim topodim, unsigned size ) { Mesh* self = (Mesh*)mesh; assert( self ); UIntMap_Insert( self->topoDataSizes, topodim, size ); }
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 ); }
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; }