void Variable_SetValueFromDictionary( void* _variable, Index index, Dictionary* dictionary ) { Variable* variable = (Variable*)_variable; Variable_Update( variable ); /* Assign variable from dictionary according to data type */ switch (variable->dataTypes[0]) { case Variable_DataType_Char: Variable_SetValueChar( variable, index, Dictionary_GetUnsignedInt( dictionary, variable->name )); break; case Variable_DataType_Short: Variable_SetValueShort( variable, index, Dictionary_GetUnsignedInt( dictionary, variable->name )); break; case Variable_DataType_Int: Variable_SetValueInt( variable, index, Dictionary_GetInt( dictionary, (Dictionary_Entry_Key)variable->name ) ); break; case Variable_DataType_Float: Variable_SetValueFloat( variable, index, Dictionary_GetDouble( dictionary, variable->name )); break; case Variable_DataType_Double: Variable_SetValueDouble( variable, index, Dictionary_GetDouble( dictionary, variable->name )); break; default: { Journal_Printf( Journal_MyStream( Error_Type, variable ), "In func %s: Unable to set value of %s from dictionary.", __func__, variable->name ); } } }
void _lucMeshSampler_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucMeshSampler* self = (lucMeshSampler*)drawingObject; self->elementRes[I_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResI" ); self->elementRes[J_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResJ" ); self->elementRes[K_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResK" ); /* Construct Parent */ _lucMeshCrossSection_AssignFromXML( self, cf, data ); _lucMeshSampler_Init(self); /* No lighting */ //TODO: Set via python properties //self->lit = False; }
void _lucIsosurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucIsosurface* self = (lucIsosurface*)drawingObject; Index defaultRes; IJK resolution; double isovalue; lucDrawingObjectMask mask; /* Construct Parent */ _lucDrawingObject_AssignFromXML( self, cf, data ); self->elementRes[I_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResI" ); self->elementRes[J_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResJ" ); self->elementRes[K_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResK" ); defaultRes = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 1.0); resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultRes); resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultRes); resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultRes); /* Get fields */ self->isosurfaceField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"IsosurfaceField", FieldVariable, True, data ); self->colourField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourField", FieldVariable, False, data ); self->maskField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaskField", FieldVariable, False, data ); if (defaultRes == 1 && (resolution[I_AXIS] > 2 || resolution[J_AXIS] > 2 || resolution[K_AXIS] > 2)) { Journal_Printf( lucInfo, "** WARNING ** excessive isosurface resolution: samples per element reduced to 2,2,2 - was %d,%d,%d\n", resolution[I_AXIS], resolution[J_AXIS], resolution[K_AXIS]); resolution[I_AXIS] = resolution[J_AXIS] = resolution[K_AXIS] = 2; } lucDrawingObjectMask_Construct( &mask, self->name, cf, data ); isovalue = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"isovalue", 0.0 ); _lucIsosurface_Init( self, isovalue, resolution, Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawWalls", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"sampleGlobal", False ), &mask ); }
void _lucVectorArrowsOnMesh_Draw( void* drawingObject, lucDatabase* database, void* _context ) { lucVectorArrowsOnMesh* self = (lucVectorArrowsOnMesh*)drawingObject; DomainContext* context = (DomainContext*) _context; Dimension_Index dim = context->dim; if ( dim == 2 ) { _lucVectorArrowMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0, K_AXIS, False), database, dim); } else { int idx; int zres = Dictionary_GetInt( context->CF->rootDict, (Dictionary_Entry_Key)"elementResK" ); for ( idx=0; idx <= zres; idx++) { _lucVectorArrowMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, idx, K_AXIS, False), database, dim); } } }