public void ExplicitComponentDerived() { Dec.Config.TestParameters = new Dec.Config.UnitTestParameters { explicitStaticRefs = new System.Type[] { typeof(EntityTemplateDecs) } }; var parser = new Dec.Parser(); parser.AddString(@" <Decs> <ComponentDec decName=""EntityComponent""> <type>SimpleComponent</type> </ComponentDec> <EntityDec decName=""EntityModel""> <components> <li>EntityComponent</li> </components> </EntityDec> </Decs> "); parser.Finish(); Environment.Startup(); var comp = new DerivedComponent(); var entity = new Entity(EntityTemplateDecs.EntityModel, comp); Assert.AreSame(comp, entity.Component <SimpleComponent>()); }
public static MeepStepFunction OutputFieldComponent(DerivedComponent component) { switch (component) { case DerivedComponent.HEnergyDensity: return(OutputMagneticPower()); case DerivedComponent.DEnergyDensity: return(OutputElectricPower()); case DerivedComponent.EnergyDensity: return(OutputTotalPower()); } string res = "output-sfield"; switch ((int)component % 10) { case 1: res += "-x"; break; case 2: res += "-y"; break; case 3: res += "-z"; break; case 4: res += "-r"; break; case 5: res += "-p"; break; } return(new MeepOutputComponent(res)); }
public static string ToStringEx(this DerivedComponent dcom) { switch (dcom) { case DerivedComponent.Sx: return("Sx"); case DerivedComponent.Sy: return("Sy"); case DerivedComponent.Sz: return("Sz"); case DerivedComponent.Sr: return("Sr"); case DerivedComponent.Sp: return("Sp"); case DerivedComponent.EnergyDensity: return("EnergyDensity"); case DerivedComponent.DEnergyDensity: return("DEnergyDensity"); case DerivedComponent.HEnergyDensity: return("HEnergyDensity"); default: return(""); } }