void _DomainContext_AssignFromXML( void* context, Stg_ComponentFactory* cf, void* data ) { DomainContext* self = (DomainContext*)context; Dictionary *contextDict = NULL; _AbstractContext_AssignFromXML( context, cf, data ); self->dim = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "dim", 2 ); self->verticalAxis = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "VerticalAxis", 1 ); /* try grab the scaling component and put it on the context * check for the contextDict first as ConstructByKey NEEDS the conextDict * and in units tests the contextDict sometime doesn't exist */ contextDict = Dictionary_GetDictionary( cf->componentDict, self->name ); if( contextDict ) { self->scaling = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Scaling", Scaling, False, data ); } if( !self->scaling ) { self->scaling = Stg_ComponentFactory_ConstructByName( cf, (Name)"default_scaling", Scaling, False, data ); } /* The following is for backward compatiblity with old (GALE) xml files. */ { /* Post change 1d3dc4e00549 in this repositroy, the old style of DofLayout * XML definition was illegal. This change allows for the old style. * * Here we build all 'MeshVariable' components first. * * This is a hack, selective construction of general component over other is * a weakness to the object model and should be avoided. This section should * be removed in future and xml files updated in accordance with change 1d3dc4e00549 */ Stg_Component *component=NULL; Index component_I; for( component_I = 0; component_I < LiveComponentRegister_GetCount( cf->LCRegister ); component_I++ ){ /* Grab component from register */ component = LiveComponentRegister_At( cf->LCRegister, component_I ); /* if not a "MeshVariable" do nothing */ if( strcmp( component->type, MeshVariable_Type ) ) continue; if( component && !component->isConstructed ){ Journal_Printf( cf->infoStream, "Constructing %s as %s\n", component->type, component->name ); Stg_Component_AssignFromXML( component, cf, data, True ); } } } _DomainContext_Init( self ); }
DomainContext* DomainContext_New( Name name, double start, double stop, MPI_Comm communicator, Dictionary* dictionary ) { DomainContext* self = _DomainContext_DefaultNew( name ); self->isConstructed = True; _AbstractContext_Init( (AbstractContext*) self ); _DomainContext_Init( self ); return self; }
UnderworldContext* UnderworldContext_New( Name name, double start, double stop, MPI_Comm communicator, Dictionary* dictionary ) { UnderworldContext* self = (UnderworldContext*)_UnderworldContext_DefaultNew( name ); self->isConstructed = True; _AbstractContext_Init( (AbstractContext*) self ); _DomainContext_Init( (DomainContext*) self ); _FiniteElementContext_Init( (FiniteElementContext*) self ); _PICelleratorContext_Init( (PICelleratorContext*) self ); _UnderworldContext_Init( self ); return self; }