/// <summary> /// Expand this datastore value access into a list of value access expressions /// on scalar and multivector values /// </summary> /// <returns></returns> public IEnumerable <AstDatastoreValueAccess> ExpandStructures() { return (AssociatedValueAccess .ExpandStructures() .Select(item => new AstDatastoreValueAccess(item))); }
/// <summary> /// If this value access is a multivector this selects components belonging to the given subspace /// into a new value access of the same multivector type /// </summary> /// <param name="grade"></param> /// <param name="indexList"></param> /// <returns></returns> public AstDatastoreValueAccess SelectMultivectorComponents(int grade, IEnumerable <int> indexList) { if (IsFullMultivector) { var frame = TypeAsFrameMultivector.ParentFrame; if (frame.IsValidGrade(grade) == false) { return(null); } var idsList = frame.BasisBladeIDsOfGrade(grade, indexList); return (AssociatedValueAccess .Duplicate() .Append( ValueAccessStepByKeyList <int> .Create( AssociatedValueAccess.ExpressionType, idsList ) ) .ToAstDatastoreValueAccess()); } if (IsPartialMultivector) { var frame = TypeAsFrameMultivector.ParentFrame; if (frame.IsValidGrade(grade) == false) { return(null); } var idsList = frame.BasisBladeIDsOfGrade(grade, indexList); var oldIdsList = AssociatedValueAccess.GetBasisBladeIdsList(); var newIdsList = idsList.Where(id => oldIdsList.Contains(id)).ToArray(); if (newIdsList.Length == 0) { return(null); } return (AssociatedValueAccess .DuplicateExceptLast() .Append( ValueAccessStepByKeyList <int> .Create( AssociatedValueAccess.ExpressionType, newIdsList ) ) .ToAstDatastoreValueAccess()); } return(null); }
/// <summary> /// If this value access is on a partial multivector coefficients list, split this value access into /// two parts: A value access on the multivector type and a list of basis blades /// </summary> /// <returns></returns> public Tuple <AstDatastoreValueAccess, List <AstFrameBasisBlade> > SplitAs_PartialMultivector() { var idsList = AssociatedValueAccess.GetBasisBladeIdsList(); if (idsList == null) { return(null); } var frame = AssociatedValueAccess.LastAccessStep.AccessStepType.GetFrame(); var newValueAccess = AssociatedValueAccess.DuplicateExceptLast(); return(new Tuple <AstDatastoreValueAccess, List <AstFrameBasisBlade> >( new AstDatastoreValueAccess(newValueAccess), idsList.Select(id => new AstFrameBasisBlade(frame, id)).ToList() )); }
/// <summary> /// If this value access is on a multivector coefficient, split this value access into two parts: /// A value access on the multivector type and a basis blade /// </summary> /// <returns></returns> public Tuple <AstDatastoreValueAccess, AstFrameBasisBlade> SplitAs_MultivectorCoefficient() { var id = AssociatedValueAccess.GetBasisBladeId(); if (id < 0) { return(null); } var frame = AssociatedValueAccess.LastAccessStep.AccessStepType.GetFrame(); var newValueAccess = AssociatedValueAccess.DuplicateExceptLast(); return(new Tuple <AstDatastoreValueAccess, AstFrameBasisBlade>( new AstDatastoreValueAccess(newValueAccess), new AstFrameBasisBlade(frame, id) )); }
public override string ToString() { return(AssociatedValueAccess.GetName()); }
/// <summary> /// If this value access is on a multivector partial coefficients access, /// get the basis blades IDs of the coefficients /// </summary> /// <returns></returns> public List <int> GetBasisBladeIDsList() { var idsList = AssociatedValueAccess.GetBasisBladeIdsList(); return(idsList == null ? null : new List <int>(idsList)); }
/// <summary> /// If this value access is on a multivector coefficient, get the ID of the basis blade /// </summary> /// <returns></returns> public int GetBasisBladeId() { return(AssociatedValueAccess.GetBasisBladeId()); }