internal GMacFrameBasisVector(string basisVectorName, GMacFrame parentFrame, int basisVectorIndex, MathematicaScalar signature) : base(basisVectorName, parentFrame.ChildScope, RoleNames.FrameBasisVector, parentFrame.MultivectorType) { BasisVectorIndex = basisVectorIndex; Signature = signature; MultivectorValue = GMacValueMultivector.CreateBasisBlade(ParentFrame.MultivectorType, BasisVectorId); }
public override ILanguageValue CreateDefaultValue(ILanguageType langType) { if (ReferenceEquals(langType, null)) { throw new ArgumentNullException(); } if (langType.IsSameType(BooleanType)) { return(ValuePrimitive <bool> .Create((TypePrimitive)langType, false)); } if (langType.IsSameType(IntegerType)) { return(ValuePrimitive <int> .Create((TypePrimitive)langType, 0)); } if (langType.IsSameType(ScalarType)) { return(ValuePrimitive <MathematicaScalar> .Create((TypePrimitive)langType, SymbolicUtils.Constants.Zero)); } var typeStructure = langType as GMacStructure; if (typeStructure != null) { var structure = typeStructure; var valueSparse = ValueStructureSparse.Create(structure); //This code is not required for a sparse structure value //foreach (var data_member in structure.DataMembers) // value_sparse[data_member.ObjectName] = this.CreateDefaultValue(data_member.SymbolType); return(valueSparse); } if (!(langType is GMacFrameMultivector)) { throw new InvalidOperationException("GMac type not recognized!"); } var mvType = (GMacFrameMultivector)langType; var value = GMacValueMultivector.CreateZero(mvType); //This code is not required for a sparse multivector value //for (int id = 0; id < mv_type.ParentFrame.GASpaceDimension; id++) // value[id] = SymbolicUtils.Constants.Zero; return(value); }