double[] BuildCoordinatesAndQuadRule(int resolution) { daRuleS = gridDat.Grid.RefElements.Select(Kref => Kref.GetQuadratureRule(2 * (resolution - 3))).ToArray(); NodeSet QuadNodes = daRuleS[0].Nodes; double[] coordinates = new double[resolution]; coordinates[0] = -1; coordinates[resolution - 1] = 1; for (int i = 0; i < resolution - 2; ++i) { coordinates[i + 1] = QuadNodes[i, 0]; } return(coordinates); }
/// <summary> /// Initializes the Solver. Creates the objects that are used in the solver-method. /// Outlines the QuadNodesGlobal which are used as nodes for the geometric approach. /// Creates the edges on which the values will be defined in the solver-method. /// Creates a Cell which holds all the information of the parameters in the inside of the cell /// </summary> /// <param name="ExtPropertyBasis"></param> public ExtVelSolver_Geometric(Basis ExtPropertyBasis) { this.SolverBasis = ExtPropertyBasis; this.GridDat = (GridData)ExtPropertyBasis.GridDat; //Build Edges. double[] NodeGrid = GenericBlas.Linspace(-1, 1, Math.Max(20, (this.SolverBasis.Degree + 1) * 2)); int maxNumberOfEdges = 6; edgesOfCell = new Edge[maxNumberOfEdges]; for (int i = 0; i < maxNumberOfEdges; i++) { edgesOfCell[i] = new Edge(NodeGrid, GridDat); } DaRuleS = this.GridDat.Grid.RefElements.Select(Kref => Kref.GetQuadratureRule(this.SolverBasis.Degree * 2)).ToArray(); QuadNodesGlobal = DaRuleS.Select(rule => MultidimensionalArray.Create(rule.NoOfNodes, GridDat.SpatialDimension)).ToArray(); }
public LocalSolver_Geometric(Basis __LevelSetBasis_Geometric) { LevelSetBasis_Geometric = __LevelSetBasis_Geometric; GridDat = (GridData)(LevelSetBasis_Geometric.GridDat); int D = this.GridDat.SpatialDimension; if (D != 2) { throw new NotImplementedException("Geometric solver currently only implemented for 2D."); } if (!(this.GridDat.Edges.EdgeRefElements.Count() == 1 && this.GridDat.Edges.EdgeRefElements.First().GetType() == typeof(Foundation.Grid.RefElements.Line))) { throw new NotImplementedException(); } double[] _EdgeNodes = GenericBlas.Linspace(-1, 1, Math.Max(10, (this.LevelSetBasis_Geometric.Degree + 1) * 2)); int NN = _EdgeNodes.Length; this.EdgeNodes = new NodeSet(GridDat.Edges.EdgeRefElements[0], NN, 1); EdgeNodes.ExtractSubArrayShallow(-1, 0).SetVector(_EdgeNodes); this.EdgeNodes.LockForever(); DaRuleS = this.GridDat.Grid.RefElements.Select(Kref => Kref.GetQuadratureRule(this.LevelSetBasis_Geometric.Degree * 2)).ToArray(); QuadNodesGlobal = DaRuleS.Select(rule => MultidimensionalArray.Create(rule.NoOfNodes, D)).ToArray(); int NNKmax = 4; PhiEvalBuffer = new MultidimensionalArray[NNKmax]; CellNodesGlobal = new MultidimensionalArray[NNKmax]; for (int i = 0; i < NNKmax; i++) { PhiEvalBuffer[i] = MultidimensionalArray.Create(1, NN); CellNodesGlobal[i] = MultidimensionalArray.Create(NN, D); } }
/// <summary> /// adds rules with fixed quadrature order to the quadrature scheme <paramref name="scheme"/>; /// this can be used to explicitly specify the quadrature order, the choice of the order during the compilation of the scheme /// (see <see cref="QuadratureScheme{A,B}.Compile"/>) will have no effect. /// </summary> public static EdgeQuadratureScheme AddFixedOrderRules(this EdgeQuadratureScheme scheme, IGridData GridDat, int order) { var QRs = GridDat.iGeomEdges.EdgeRefElements.Select(Kref => Kref.GetQuadratureRule(order)); return(scheme.AddFixedRuleS <EdgeQuadratureScheme, QuadRule, EdgeMask>(QRs)); }
/// <summary> /// adds rules with fixed quadrature order to the quadrature scheme <paramref name="scheme"/>; /// this can be used to explicitly specify the quadrature order, the choice of the order during the compilation of the scheme /// (see <see cref="QuadratureScheme{A,B}.Compile"/>) will have no effect. /// </summary> public static CellQuadratureScheme AddFixedOrderRules(this CellQuadratureScheme scheme, IGridData GridDat, int order) { var QRs = GridDat.iGeomCells.RefElements.Select(Kref => Kref.GetQuadratureRule(order)); return(scheme.AddFixedRuleS <QuadRule>(QRs)); }