void _lucEigenvectorsCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject; /* Construct Parent */ self->defaultResolution = 8; /* Default sampling res */ _lucCrossSection_AssignFromXML( self, cf, data ); self->gatherData = False; /* Drawn in parallel */ strcpy(self->fieldVariableName, "TensorField"); _lucEigenvectorsCrossSection_Init( self, Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 2 ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColour", "black" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColour", "black" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColour", "black" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 1.0 ), Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"glyphs", 3), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useEigenValue", True ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenVector", True ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenValue", False ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColourForNegative", "black" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColourForNegative", "black" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black" ) ); }
void _lucAxis_AssignFromXML( void* axis, Stg_ComponentFactory* cf, void* data ) { lucAxis* self = (lucAxis*) axis; Name colourNameX; Name colourNameY; Name colourNameZ; Coord origin; /* Construct Parent */ _lucDrawingObject_AssignFromXML( self, cf, data ); colourNameX = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourX", "Red" ) ; colourNameY = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourY", "Green" ) ; colourNameZ = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourZ", "Blue" ) ; lucColour_FromString( &self->colours[0], colourNameX ); lucColour_FromString( &self->colours[1], colourNameY ); lucColour_FromString( &self->colours[2], colourNameZ ); origin[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", 32.0 ); origin[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", 32.0 ); origin[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", 0.25 ); _lucAxis_Init( self, origin, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"axes", "xyz" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelX", "X" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelY", "Y" ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelZ", "Z" ), self->colours[0], self->colours[1], self->colours[2]); }
void _ViscosityLimiter_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ){ ViscosityLimiter* self = (ViscosityLimiter*)_self; /* Construct Parent */ _Rheology_AssignFromXML( self, cf, data ); _ViscosityLimiter_Init( self, self->maxViscosity = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxViscosity", 1E4 ), self->minViscosity = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minViscosity", 1E-2 ) ); }
void _Ppc_PointGravity_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ) { Ppc_PointGravity* self = (Ppc_PointGravity*)_self; /* Construct parent */ _Ppc_AssignFromXML( self, cf, data ); _Ppc_PointGravity_Init( self, PpcManager_GetPpcFromDict( self->manager, cf, self->name, (Dictionary_Entry_Key)"Alpha", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"xcoord", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ycoord", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"zcoord", 0.0 ) ); }
void _SurfaceAdaptor_Construct( void* adaptor, Stg_ComponentFactory* cf, void* data ) { SurfaceAdaptor* self = (SurfaceAdaptor*)adaptor; Dictionary* dict; char* surfaceType; assert( self ); assert( cf ); /* Call parent construct. */ _MeshAdaptor_Construct( self, cf, data ); /* Rip out the components structure as a dictionary. */ dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) ); /* What kind of surface do we want? */ surfaceType = Stg_ComponentFactory_GetString( cf, self->name, "surfaceType", "" ); if( !strcmp( surfaceType, "wedge" ) ) { self->surfaceType = SurfaceAdaptor_SurfaceType_Wedge; self->info.wedge.offs = Stg_ComponentFactory_GetDouble( cf, self->name, "offset", 0.0 ); self->info.wedge.grad = Stg_ComponentFactory_GetDouble( cf, self->name, "gradient", 0.5 ); } else if( !strcmp( surfaceType, "sine" ) || !strcmp( surfaceType, "cosine" ) ) { Dictionary_Entry_Value* originList; if( !strcmp( surfaceType, "sine" ) ) self->surfaceType = SurfaceAdaptor_SurfaceType_Sine; else self->surfaceType = SurfaceAdaptor_SurfaceType_Cosine; originList = Dictionary_Get( dict, "origin" ); if( originList ) { unsigned nDims; unsigned d_i; nDims = Dictionary_Entry_Value_GetCount( originList ); for( d_i = 0; d_i < nDims; d_i++ ) { Dictionary_Entry_Value* val; val = Dictionary_Entry_Value_GetElement( originList, d_i ); self->info.trig.origin[d_i] = Dictionary_Entry_Value_AsDouble( val ); } } else memset( self->info.trig.origin, 0, sizeof(double) * 2 ); self->info.trig.amp = Stg_ComponentFactory_GetDouble( cf, self->name, "amplitude", 1.0 ); self->info.trig.freq = Stg_ComponentFactory_GetDouble( cf, self->name, "frequency", 1.0 ); } else _SurfaceAdaptor_Init( self ); }
void _BelowCosinePlane_Construct( void* belowPlane, Stg_ComponentFactory* cf, void* data ) { BelowCosinePlane* self = (BelowCosinePlane*) belowPlane; double delta; double period; double phase; _BelowPlane_Construct( self, cf, data ); delta = Stg_ComponentFactory_GetDouble( cf, self->name, "delta", 0.5 ); period = Stg_ComponentFactory_GetDouble( cf, self->name, "period", 1.0 ); phase = Stg_ComponentFactory_GetDouble( cf, self->name, "phase", 0.0 ); _BelowCosinePlane_Init( self, self->offset, self->width, delta, period, phase ); }
void _HKViscousCreep_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){ HKViscousCreep* self = (HKViscousCreep*)rheology; PpcManager *mgr=NULL; int sr, temp, press; /* Construct Parent */ _Rheology_AssignFromXML( self, cf, data ); mgr = self->mgr; sr = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "StrainRateInvariantField", False ); temp = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "TemperatureField", False ); press = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "PressureField", False ); _HKViscousCreep_Init( self, sr, temp, press, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"StressExponent", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"DefaultStrainRateInvariant", 1.0e-13 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"PreExponentialFactor", 1.0 ), PpcManager_GetPpcFromDict( mgr, cf, self->name, "GrainSize", "" ), PpcManager_GetPpcFromDict( mgr, cf, self->name, "WaterFugacity", "" ), PpcManager_GetPpcFromDict( mgr, cf, self->name, "MeltFraction", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"GrainSizeExponent", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"WaterFugacityExponent", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"MeltFractionFactor", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ActivationEnergy", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ActivationVolume", 0.0 ) ); }
void _lucSwarmVectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucSwarmVectors* self = (lucSwarmVectors*)drawingObject; /* Construct Parent */ _lucSwarmViewer_AssignFromXML( self, cf, data ); _lucSwarmVectors_Init( self, Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"DirectionVariable", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 2.0 ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ThicknessVariable", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"thickness", 0.0 ), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"LengthVariable", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 1.0 ) ); }
void _BelowPlane_AssignFromXML( void* belowPlane, Stg_ComponentFactory* cf, void* data ) { BelowPlane* self = (BelowPlane*) belowPlane; double offset; XYZ minValue; XYZ maxValue; XYZ width; _Stg_Shape_AssignFromXML( self, cf, data ); offset = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"offset", 0.5 ); minValue[ I_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"minX", 0.0 ); minValue[ J_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"minY", 0.0 ); minValue[ K_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"minZ", 0.0 ); maxValue[ I_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"maxX", 1.0 ); maxValue[ J_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"maxY", 1.0 ); maxValue[ K_AXIS ] = Stg_ComponentFactory_GetRootDictDouble( cf, (Dictionary_Entry_Key)"maxZ", 1.0 ); width[ I_AXIS ] = maxValue[ I_AXIS ] - minValue[ I_AXIS ] ; width[ J_AXIS ] = maxValue[ J_AXIS ] - minValue[ J_AXIS ] ; width[ K_AXIS ] = maxValue[ K_AXIS ] - minValue[ K_AXIS ] ; _BelowPlane_Init( self, offset, width, minValue, maxValue ); }
void _Stokes_SLE_UzawaSolver_AssignFromXML( void* solver, Stg_ComponentFactory* cf, void* data ) { Stokes_SLE_UzawaSolver* self = (Stokes_SLE_UzawaSolver*) solver; double tolerance; Iteration_Index maxUzawaIterations, minUzawaIterations; StiffnessMatrix* preconditioner; Bool useAbsoluteTolerance; Bool monitor; _SLE_Solver_AssignFromXML( self, cf, data ); tolerance = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"tolerance", 1.0e-5 ); maxUzawaIterations = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"maxIterations", 1000 ); minUzawaIterations = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"minIterations", 1 ); useAbsoluteTolerance = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useAbsoluteTolerance", False ); monitor = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"monitor", False ); preconditioner = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Preconditioner", StiffnessMatrix, False, data ); _Stokes_SLE_UzawaSolver_Init( self, preconditioner, maxUzawaIterations, minUzawaIterations, tolerance, useAbsoluteTolerance, monitor ); if( self->velSolver == PETSC_NULL ) { //KSPCreate( MPI_COMM_WORLD, &self->velSolver ); //KSPSetOptionsPrefix( self->pcSolver, "Uzawa_velSolver_" ); } }
void _Byerlee_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){ Byerlee* self = (Byerlee*)rheology; FeMesh* mesh; int height_id; /* Construct Parent */ _VonMises_AssignFromXML( self, cf, data ); mesh = Stg_ComponentFactory_ConstructByNameWithKeyFallback( cf, self->name, (Name)"mesh-linear", (Dictionary_Entry_Key)"FeMesh", FeMesh, True, data ); height_id = PpcManager_GetPpcFromDict( self->mgr, cf, self->name, (Dictionary_Entry_Key)"HeightReferenceInput", "" ); if( height_id == -1 ) { Journal_Printf( global_info_stream, "\nUsing maximum mesh height in y-axis for a height reference\n" "To use a (Ppc) function a the line\n\t<param name=\"HeightReferenceInput\">someInputfunction</param>\n\n" ); } _Byerlee_Init( self, mesh, height_id, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"depthCoefficient", 0.0 ) ); }
void _VonMises_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){ VonMises* self = (VonMises*)rheology; int strainRate_id; /* Construct Parent */ _YieldRheology_AssignFromXML( self, cf, data ); /* PpcManager_GetField_TestForFeVariable */ strainRate_id = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "StrainRateField", True ); _VonMises_Init( self, strainRate_id, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesion", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesionAfterSoftening", 0.0 ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"strainRateSoftening", False ) ); }
void _DruckerPrager_AssignFromXML( void* druckerPrager, Stg_ComponentFactory* cf, void* data ){ DruckerPrager* self = (DruckerPrager*)druckerPrager; int pressure_id, velocityGradientsField_id; /* Construct Parent */ _VonMises_AssignFromXML( self, cf, data ); pressure_id = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "PressureField", True ); velocityGradientsField_id = PpcManager_GetField( self->mgr, cf, (Stg_Component*)self, "VelocityGradientsField", False ); _DruckerPrager_Init( self, pressure_id, velocityGradientsField_id, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimumYieldStress", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficient", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficientAfterSoftening", 0.0 ) ); }
void _lucVectorArrowCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject; /* Construct Parent */ self->defaultResolution = 8; /* Default sampling res */ _lucCrossSection_AssignFromXML( self, cf, data ); self->gatherData = False; /* Drawn in parallel */ strcpy(self->fieldVariableName, "VectorVariable"); _lucVectorArrowCrossSection_Init( self, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0 ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", True ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3 ), Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"glyphs", 3)); }
void _Ppc_a_Vector_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ) { Ppc_a_Vector* self = (Ppc_a_Vector*)_self; Dictionary* theDictionary; /* Construct parent */ _Ppc_AssignFromXML( self, cf, data ); /* The dictionary */ theDictionary = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, (Dictionary_Entry_Key)self->name ) ); _Ppc_a_Vector_Init( self, PpcManager_GetPpcFromDict( self->manager, cf, self->name, (Dictionary_Entry_Key)"Alpha", "" ), PpcManager_GetPpcFromDict( self->manager, cf, self->name, (Dictionary_Entry_Key)"Vector", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"vi", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"vj", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"vk", 0.0 ) ); }
void _Sphere_AssignFromXML( void* sphere, Stg_ComponentFactory* cf, void* data ) { Sphere* self = (Sphere*) sphere; double radius; _Stg_Shape_AssignFromXML( self, cf, data ); radius = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"radius", 0.0 ); _Sphere_Init( self, radius ); }
void _Ppc_Auto_Thermal_Profile_AssignFromXML( void* _self, Stg_ComponentFactory* cf, void* data ) { Ppc_Auto_Thermal_Profile* self = (Ppc_Auto_Thermal_Profile*)_self; /* Construct parent */ _Ppc_AssignFromXML( self, cf, data ); _Ppc_Auto_Thermal_Profile_Init( self, PpcManager_GetPpcFromDict( self->manager, cf, (Name)self->name, "Diffusivity", ""), PpcManager_GetPpcFromDict( self->manager, cf, (Name)self->name, "Density", "" ), PpcManager_GetPpcFromDict( self->manager, cf, (Name)self->name, "Cp", "" ), PpcManager_GetPpcFromDict( self->manager, cf, (Name)self->name, "RadiogenicHeat", "" ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"StartCoord", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"EndCoord", 100000.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"MinTemp", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"MaxTemp", 1000.0 ), Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"Axis", 1 ) ); }
void _lucContourCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucContourCrossSection* self = (lucContourCrossSection*)drawingObject; /* Construct Parent */ self->defaultResolution = 8; /* Default sampling res */ _lucCrossSection_AssignFromXML( self, cf, data ); _lucContourCrossSection_Init( self, Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"showValues", True ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"printUnits", False ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minIsovalue", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIsovalue", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"interval", 0.33 ) ) ; /* Drawing settings for this component */ //TODO: Set via python properties //self->lit = False; }
void _NonNewtonianAbs_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){ NonNewtonianAbs* self = (NonNewtonianAbs*)rheology; FeVariable* strainRateInvField; /* Construct Parent */ _Rheology_AssignFromXML( self, cf, data ); /* TODO: 'Keyfallback' soon to be deprecated/updated */ strainRateInvField = Stg_ComponentFactory_ConstructByNameWithKeyFallback( cf, self->name, (Name)"StrainRateInvariantField", (Dictionary_Entry_Key)"StrainRateInvariantField", FeVariable, True, data ); /*strainRateInvField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "StrainRateInvariantField", FeVariable, True);*/ _NonNewtonianAbs_Init( self, strainRateInvField, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"initialViscosity", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"defaultStrainRateInvariant", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"stressExponent", 1.0 ) ); }
void _ThermalBuoyancyForceTerm_AssignFromXML( void* forceTerm, Stg_ComponentFactory* cf, void* data ) { ThermalBuoyancyForceTerm* self = (ThermalBuoyancyForceTerm*)forceTerm; FeVariable* temperatureField; double rayleighNumber; /* Construct Parent */ _ForceTerm_AssignFromXML( self, cf, data ); temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TemperatureField", FeVariable, True, data ) ; rayleighNumber = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"Ra", 0.0 ); _ThermalBuoyancyForceTerm_Init( self, temperatureField, rayleighNumber ); }
void _StokesBlockKSPInterface_AssignFromXML( void* solver, Stg_ComponentFactory* cf, void* data ) { StokesBlockKSPInterface* self = (StokesBlockKSPInterface*) solver; //double tolerance; //Iteration_Index maxUzawaIterations, minUzawaIterations; StiffnessMatrix* preconditioner; StiffnessMatrix* k2StiffMat; ForceVector* f2ForceVec; StiffnessMatrix* mStiffMat; ForceVector* jForceVec; double penaltyNumber; double hFactor; StiffnessMatrix* vmStiffMat; ForceVector* vmForceVec; //Bool useAbsoluteTolerance; //Bool monitor; Stokes_SLE * st_sle; PETScMGSolver * mg; //Name filename; //char* string; _SLE_Solver_AssignFromXML( self, cf, data ); preconditioner = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Preconditioner", StiffnessMatrix, False, data ); st_sle = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"stokesEqn", Stokes_SLE, True, data ); mg = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"mgSolver", PETScMGSolver, False, data); k2StiffMat = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"2ndStressTensorMatrix", StiffnessMatrix, False, data ); f2ForceVec = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"2ndForceVector", ForceVector, False, data ); penaltyNumber = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"penaltyNumber", 0.0 ); hFactor = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"hFactor", 0.0 ); mStiffMat = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MassMatrix", StiffnessMatrix, False, data ); jForceVec = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"JunkForceVector", ForceVector, False, data ); vmStiffMat = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VelocityMassMatrix", StiffnessMatrix, False, data ); vmForceVec = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VMassForceVector", ForceVector, False, data ); _StokesBlockKSPInterface_Init( self, preconditioner, st_sle, mg, NULL, NULL, k2StiffMat, mStiffMat, f2ForceVec, jForceVec, penaltyNumber, hFactor, vmStiffMat, vmForceVec); }
void _ViscousPenaltyConstMatrixCartesian_AssembleFromXML( void* constitutiveMatrix, Stg_ComponentFactory* cf, void* data ) { ViscousPenaltyConstMatrixCartesian* self = (ViscousPenaltyConstMatrixCartesian*)constitutiveMatrix; double incompressibility_Penalty; Bool viscosityWeighting; /* Construct Parent */ _ConstitutiveMatrix_AssignFromXML( self, cf, data ); incompressibility_Penalty = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"incompressibility_Penalty", 0.0 ); viscosityWeighting = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"viscosity_weighting", True ); _ViscousPenaltyConstMatrixCartesian_Init( self, incompressibility_Penalty, viscosityWeighting ); }
void _lucIsosurfaceCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) { lucIsosurfaceCrossSection* self = (lucIsosurfaceCrossSection*)drawingObject; IJK resolution = {100,100,100}; lucIsosurface* isosurface; /* Construct Parent */ self->defaultResolution = 100; /* Default sampling res */ _lucCrossSection_AssignFromXML( self, cf, data ); /* Create and initialise isosurface object */ isosurface = (lucIsosurface*)_lucIsosurface_DefaultNew(self->name); _lucIsosurface_AssignFromXML(isosurface, cf, data ); /* Force global sampling on */ isosurface->sampleGlobal = True; _lucIsosurfaceCrossSection_Init( self, resolution, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minIsovalue", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIsovalue", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"interval", 0.33 ), isosurface); }
void _GALEDruckerPrager_AssignFromXML( void* druckerPrager, Stg_ComponentFactory* cf, void* data ){ GALEDruckerPrager* self = (GALEDruckerPrager*)druckerPrager; FeVariable* pressureField = NULL; SwarmVariable* swarmPressure = NULL; MaterialPointsSwarm* materialPointsSwarm = NULL; /* Construct Parent */ _GALEVonMises_AssignFromXML( self, cf, data ); pressureField = (FeVariable *) Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, False, data ); swarmPressure = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"swarmPressure", SwarmVariable, False, data ); Journal_Firewall( ( pressureField || swarmPressure ), Journal_Register( Error_Type, (Name)self->type ), "\n Error in component type %s, name '%s'.\n Must specify a PressureField OR a swarmPressure, but not both. \n", self->type, self->name ); materialPointsSwarm = (MaterialPointsSwarm*) Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data ); _GALEDruckerPrager_Init( self, pressureField, swarmPressure, materialPointsSwarm, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficient", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficientAfterSoftening", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"boundaryCohesion", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"boundaryCohesionAfterSoftening", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"boundaryFrictionCoefficient", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"boundaryFrictionCoefficientAfterSoftening", 0.0 ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryBottom", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryTop", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryLeft", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryRight", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryFront", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"boundaryBack", False ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimumYieldStress", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimumViscosity", 0.0), Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"HydrostaticTerm", HydrostaticTerm, False, data ) ); }
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 _GALENonNewtonian_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){ GALENonNewtonian* self = (GALENonNewtonian*)rheology; FeVariable *strainRateInvField, *temperatureField; double refStrainRate; Stream* errorStream = Journal_Register( Error_Type, GALENonNewtonian_Type ); /* Construct Parent */ _Rheology_AssignFromXML( self, cf, data ); /* TODO: 'Keyfallback' soon to be deprecated/updated */ strainRateInvField = Stg_ComponentFactory_ConstructByNameWithKeyFallback( cf, self->name, (Name)"StrainRateInvariantField", (Name)"StrainRateInvariantField", FeVariable, True, data ); temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TemperatureField", FeVariable, True, data ); refStrainRate=Stg_ComponentFactory_GetDouble( cf, self->name, "refStrainRate", 0.0 ); if(refStrainRate==0.0) Journal_Firewall(0,errorStream, "refStrainRate must be set to a non-zero number in a GALENonNewtonian rheology"); _GALENonNewtonian_Init( self, strainRateInvField, temperatureField, Stg_ComponentFactory_GetDouble( cf, self->name, "n", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, "T_0", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, "A", 1.0 ), refStrainRate, Stg_ComponentFactory_GetDouble( cf, self->name, "minViscosity", 0.0 ) , Stg_ComponentFactory_GetDouble( cf, self->name, "maxViscosity", 0.0 ) ); }
void _lucViewport_AssignFromXML( void* viewport, Stg_ComponentFactory* cf, void* data ) { lucViewport* self = (lucViewport*) viewport; DrawingObject_Index drawingObjectCount; lucDrawingObject** drawingObjectList; lucCamera* camera; /* TODO Construct Parent */ self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data ); if ( !self->context ) self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data ); camera = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Camera", lucCamera, True, data ) ; drawingObjectList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"DrawingObject", Stg_ComponentFactory_Unlimited, lucDrawingObject, True, &drawingObjectCount, data ); _lucViewport_Init( self, camera, drawingObjectList, drawingObjectCount, Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"title", ""), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"axis", False ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"axisLength", 0.2 ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"antialias", True ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"rulers", False ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"timestep", False ), Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"border", 0), Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"borderColour", "#888888" ), Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"disable", False ), Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"margin", 32), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"nearClipPlane", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"farClipPlane", 0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleX", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleY", 1.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleZ", 1.0 )); Memory_Free( drawingObjectList ); }
void _SingleCellLayout_Construct( void* singleCellLayout, Stg_ComponentFactory* cf, void* data ){ SingleCellLayout* self = (SingleCellLayout*)singleCellLayout; Bool dimExists[] = { False, False, False }; Dimension_Index dim; XYZ min; XYZ max; dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, "dim", 0 ); dimExists[ I_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsI", True ); dimExists[ J_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsJ", True ); dimExists[ K_AXIS ] = Stg_ComponentFactory_GetBool( cf, self->name, "dimExistsK", (dim == 3) ); min[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minX", -1.0 ); min[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minY", -1.0 ); min[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "minZ", -1.0 ); max[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxX", 1.0 ); max[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxY", 1.0 ); max[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, "maxZ", 1.0 ); _CellLayout_Init( (CellLayout*)self ); _SingleCellLayout_Init( self, dimExists, min, max ); }
void _GALEDivergenceForce_AssignFromXML( void* forceTerm, Stg_ComponentFactory* cf, void* data ) { GALEDivergenceForce* self = (GALEDivergenceForce*)forceTerm; Dictionary* dict; Stg_Shape* domainShape=NULL; FeMesh* geometryMesh=NULL; GALEStressBC_Entry force; char *type; /* Construct Parent */ _ForceTerm_AssignFromXML( self, cf, data ); dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) ); domainShape = Stg_ComponentFactory_ConstructByKey( cf, self->name, "DomainShape", Stg_Shape, True, data ) ; type = Stg_ComponentFactory_GetString( cf, self->name, "force_type", "" ); if(!strcasecmp(type,"double") || !strcasecmp(type,"float")) { force.type = GALEStressBC_Double; force.DoubleValue = Stg_ComponentFactory_GetDouble( cf, self->name, "force_value", 0.0 ); } else if(!strcasecmp(type,"func")) { char *funcName = Stg_ComponentFactory_GetString( cf, self->name, "force_value", "" ); Index cfIndex; cfIndex = ConditionFunction_Register_GetIndex ( condFunc_Register, funcName); force.type = GALEStressBC_ConditionFunction; if ( cfIndex == (unsigned)-1 ) { Stream* errorStr = Journal_Register( Error_Type, self->type ); Journal_Printf( errorStr, "Error- in %s: While parsing " "definition of GALEDivergenceForce, the cond. func. " " \"%s\" - wasn't found in the c.f. register.\n", __func__, funcName ); Journal_Printf( errorStr, "(Available functions in the C.F. register are: "); ConditionFunction_Register_PrintNameOfEachFunc ( condFunc_Register, errorStr ); Journal_Printf( errorStr, ")\n"); assert(0); } force.CFIndex = cfIndex; } else if(strlen(type)==0) { Stream* errorStr = Journal_Register( Error_Type, self->type ); Journal_Printf( errorStr, "Error- in %s: While parsing " "definition of GALEDivergenceForce, force_type is not specified.\nSupported types are \"double\" and \"function\".\n", __func__); assert(0); } else { Stream* errorStr = Journal_Register( Error_Type, self->type ); Journal_Printf( errorStr, "Error- in %s: While parsing " "definition of GALEDivergenceForce, the type of condition \"%s\"\nis not supported. Supported types are \"double\" and \"function\".\n", __func__, type ); assert(0); } geometryMesh=Stg_ComponentFactory_ConstructByKey( cf, self->name, "GeometryMesh", FeMesh, True, data ) ; _GALEDivergenceForce_Init( self, domainShape, geometryMesh, force); }
void _Pouliquen_etal_AssignFromXML( void* pouliquen_etal, Stg_ComponentFactory* cf, void* data ){ Pouliquen_etal* self = (Pouliquen_etal*)pouliquen_etal; FeVariable* pressureField; FeVariable* strainRateInvField; MaterialPointsSwarm* materialPointsSwarm; /* Construct Parent */ _VonMises_AssignFromXML( self, cf, data ); pressureField = (FeVariable *) Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, True, data ); strainRateInvField = (FeVariable * ) Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StrainRateInvariantField", FeVariable, True, data ); materialPointsSwarm = (MaterialPointsSwarm* ) Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data ); _Pouliquen_etal_Init( self, pressureField, strainRateInvField, materialPointsSwarm, Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimumYieldStress", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficient", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficientAfterSoftening", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"grainDiameter", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"Io", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rho_s", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_2", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_s", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_2_afterSoftening", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"mu_s_afterSoftening", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxViscosity", 0.0 ), Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minViscosity", 0.0 ) ); }