109 {
return (xi*
knot(ni+1) + (1. - xi)*
knot(ni)); }
186 void Print(std::ostream &os)
const;
213#ifdef MFEM_USE_LAPACK
292 const real_t* control_points);
303 const real_t* control_points);
318 void Print(std::ostream &os)
const;
368 bool coarsened =
false,
int multiplicity = 1);
465class ParNURBSExtension;
570 inline int KnotInd(
int edge)
const;
572 inline int KnotSign(
int edge)
const;
718 void Load(std::istream &input,
bool spacing);
748 void GetVertexDofs(
int vertex,
Array<int> &dofs)
const;
751 void GetEdgeDofs(
int edge,
Array<int> &dofs)
const;
755 virtual void SetDofToPatch() { };
780 const Array<const NURBSPatch*> &patches_);
808 void Print(std::ostream &os,
const std::string &comments =
"")
const;
1042 Table *GetGlobalElementDofTable();
1043 Table *Get1DGlobalElementDofTable();
1044 Table *Get2DGlobalElementDofTable();
1045 Table *Get3DGlobalElementDofTable();
1049 void SetActive(
const int *partitioning_,
const Array<bool> &active_bel);
1052 void BuildGroups(
const int *partitioning_,
const Table &elem_dof);
1068 const int *partitioning_,
1101 Array<int> verts, edges, faces, oedge, oface;
1103 Array<int> edgeMasterOffset, faceMasterOffset;
1106 inline static int F(
const int n,
const int N)
1107 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
1109 inline static int Or1D(
const int n,
const int N,
const int Or)
1110 {
return (Or > 0) ? n : (N - 1 - n); }
1112 inline static int Or2D(
const int n1,
const int n2,
1113 const int N1,
const int N2,
const int Or);
1115 inline int EC(
const int e,
const int n,
const int N,
const int s=1)
const
1117 return !edgeMaster[e] ? edges[e] + Or1D(n, N, s*oedge[e]) :
1118 GetMasterEdgeDof(e, Or1D(n, N, s*oedge[e]));
1121 inline int FC(
const int f,
const int m,
const int n,
1122 const int M,
const int N)
const
1124 return !faceMaster[
f] ? faces[
f] + Or2D(m, n, M, N, oface[
f]) :
1125 GetMasterFaceDof(
f, Or2D(m, n, M, N, oface[
f]));
1128 inline int FCP(
const int f,
const int m,
const int n,
1129 const int M,
const int N)
const
1131 return (faceMaster.
Size() == 0 || !faceMaster[
f]) ?
1132 pOffset + Or2D(m, n, M, N, opatch) :
1133 GetMasterFaceDof(
f, Or2D(m, n, M, N, opatch));
1139 void GetPatchKnotVectors (
int p,
const KnotVector *kv[]);
1142 void GetBdrPatchKnotVectors(
int bp,
const KnotVector *kv[],
int *okv);
1144 void SetMasterEdges(
bool dof,
const KnotVector *kv[] =
nullptr);
1145 void SetMasterFaces(
bool dof);
1146 int GetMasterEdgeDof(
const int e,
const int i)
const;
1147 int GetMasterFaceDof(
const int f,
const int i)
const;
1155 inline int nx()
const {
return I + 1; }
1159 inline int ny()
const {
return J + 1; }
1163 inline int nz()
const {
return K + 1; }
1180 inline int operator()(
const int i,
const int j)
const;
1183 inline int operator()(
const int i,
const int j,
const int k)
const;
1192 if (
data == 0 || i < 0 || i >=
nd || j < 0 || j >
ls)
1203 if (
data == 0 || i < 0 || i >=
nd || j < 0 || j >
ls)
1215 if (
data == 0 || i < 0 || i >=
ni ||
nj > 0 ||
nk > 0 ||
1228 if (
data == 0 || i < 0 || i >=
ni ||
nj > 0 ||
nk > 0 ||
1231 mfem_error(
"NURBSPatch::operator() const 1D");
1241 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
1254 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
1257 mfem_error(
"NURBSPatch::operator() const 2D");
1267 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
1268 k >=
nk || l < 0 || l >=
Dim)
1280 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
1281 k >=
nk || l < 0 || l >=
Dim)
1283 mfem_error(
"NURBSPatch::operator() const 3D");
1293 return kv >= 0 ? kv : -1 - kv;
1333inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
1334 const int N1,
const int N2,
const int Or)
1338 case 0:
return n1 + n2*N1;
1339 case 1:
return n2 + n1*N2;
1340 case 2:
return n2 + (N1 - 1 - n1)*N2;
1341 case 3:
return (N1 - 1 - n1) + n2*N1;
1342 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
1343 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
1344 case 6:
return (N2 - 1 - n2) + n1*N2;
1345 case 7:
return n1 + (N2 - 1 - n2)*N1;
1355 const int i1 = i - 1;
1358 case 0:
return verts[0];
1359 case 1:
return edgeMaster.
Size() > 0 && edgeMaster[0] ?
1360 GetMasterEdgeDof(0, Or1D(i1, I, opatch)) :
1361 pOffset + Or1D(i1, I, opatch);
1362 case 2:
return verts[1];
1365 mfem_error(
"NURBSPatchMap::operator() const 1D");
1372 const int i1 = i - 1, j1 = j - 1;
1373 switch (3*F(j1, J) + F(i1, I))
1375 case 0:
return verts[0];
1376 case 1:
return EC(0, i1, I);
1377 case 2:
return verts[1];
1378 case 3:
return EC(3, j1, J, -1);
1379 case 4:
return FCP(0, i1, j1, I, J);
1380 case 5:
return EC(1, j1, J);
1381 case 6:
return verts[3];
1382 case 7:
return EC(2, i1, I, -1);
1383 case 8:
return verts[2];
1386 mfem_error(
"NURBSPatchMap::operator() const 2D");
1394 const int i1 = i - 1, j1 = j - 1, k1 = k - 1;
1395 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
1397 case 0:
return verts[0];
1398 case 1:
return EC(0, i1, I);
1399 case 2:
return verts[1];
1400 case 3:
return EC(3, j1, J);
1401 case 4:
return FC(0, i1, J - 1 - j1, I, J);
1402 case 5:
return EC(1, j1, J);
1403 case 6:
return verts[3];
1404 case 7:
return EC(2, i1, I);
1405 case 8:
return verts[2];
1406 case 9:
return EC(8, k1, K);
1407 case 10:
return FC(1, i1, k1, I, K);
1408 case 11:
return EC(9, k1, K);
1409 case 12:
return FC(4, J - 1 - j1, k1, J, K);
1410 case 13:
return pOffset + I*(J*k1 + j1) + i1;
1411 case 14:
return FC(2, j1, k1, J, K);
1412 case 15:
return EC(11, k1, K);
1413 case 16:
return FC(3, I - 1 - i1, k1, I, K);
1414 case 17:
return EC(10, k1, K);
1415 case 18:
return verts[4];
1416 case 19:
return EC(4, i1, I);
1417 case 20:
return verts[5];
1418 case 21:
return EC(7, j1, J);
1419 case 22:
return FC(5, i1, j1, I, J);
1420 case 23:
return EC(5, j1, J);
1421 case 24:
return verts[7];
1422 case 25:
return EC(6, i1, I);
1423 case 26:
return verts[6];
1426 mfem_error(
"NURBSPatchMap::operator() const 3D");
Dynamic 2D array using row-major layout.
int Size() const
Return the logical size of the array.
Data type dense matrix using column-major storage.
Abstract class for all finite elements.
Class for grid function - Vector with associated FE space.
A vector of knots in one dimension, with B-spline basis functions of a prescribed order.
~KnotVector()
Destroys KnotVector.
std::shared_ptr< SpacingFunction > spacing
Function to define the distribution of knots for any number of knot spans.
void FindMaxima(Array< int > &ks, Vector &xi, Vector &u) const
Gives the locations of the maxima of the KnotVector in reference space. The function gives the knot s...
int findKnotSpan(real_t u) const
Return the index of the knot span containing parameter u.
void PrintFunctions(std::ostream &os, int samples=11) const
Prints the non-zero shape functions and their first and second derivatives associated with the KnotVe...
int NumOfElements
Number of elements, defined by distinct knots.
void CalcDnShape(Vector &gradn, int n, int i, real_t xi) const
Calculate n-th derivatives (order n) of the nonvanishing shape function values in grad for the elemen...
int Order
Order of the B-spline basis functions.
KnotVector & operator=(const KnotVector &kv)
bool isElement(int i) const
Return whether the knot index Order plus i is the beginning of an element.
Array< int > fact_ipiv
Banded matrix factorization.
void CalcShape(Vector &shape, int i, real_t xi) const
Calculate the nonvanishing shape function values in shape for the element corresponding to knot index...
void UniformRefinement(Vector &new_knots, int rf) const
Uniformly refine by factor rf, by inserting knots in each span.
const real_t & operator[](int i) const
Const access function to knot i.
real_t getKnotLocation(real_t xi, int ni) const
Return the parameter for element reference coordinate xi in [0,1], for the element beginning at knot ...
Vector knot
Stores the values of all knots.
KnotVector()=default
Create an empty KnotVector.
int GetNKS() const
Return the number of control points minus the order. This is not the number of knot spans,...
KnotVector * FullyCoarsen()
Coarsen to a single element.
void GetElements()
Count the number of elements.
KnotVector * DegreeElevate(int t) const
Return a new KnotVector with elevated degree by repeating the endpoints of the KnotVector.
static const int MaxOrder
void CalcD2Shape(Vector &grad2, int i, real_t xi) const
Calculate second-order shape function derivatives, using CalcDnShape.
int GetOrder() const
Return the order.
int GetNCP() const
Return the number of control points.
int NumOfControlPoints
Number of control points.
void CalcDShape(Vector &grad, int i, real_t xi) const
Calculate derivatives of the nonvanishing shape function values in grad for the element corresponding...
int Size() const
Return the number of knots, including multiplicities.
void FindInterpolant(Array< Vector * > &x, bool reuse_inverse=false)
Global curve interpolation through the points x (overwritten). x is an array with the length of the s...
bool coarse
Flag to indicate whether the KnotVector has been coarsened, which means it is ready for non-nested re...
void Flip()
Reverse the knots.
DenseMatrix A_coll_inv
Row pivot indices.
void Difference(const KnotVector &kv, Vector &diff) const
int GetCoarseningFactor() const
Vector GetFineKnots(const int cf) const
real_t & operator[](int i)
Access function to knot i.
int GetNE() const
Return the number of elements, defined by distinct knots.
KnotVector(const KnotVector &kv)
Copy constructor.
void Refinement(Vector &new_knots, int rf) const
Refine with refinement factor rf.
void Print(std::ostream &os) const
Print the order, number of control points, and knots.
int GetAttribute(int i) const
Return the attribute of element i.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
void SetAttribute(int i, int attr)
Set the attribute of element i.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
int GetNBE() const
Returns number of boundary elements.
NCMesh * ncmesh
Optional nonconforming mesh extension.
void SetBdrAttribute(int i, int attr)
Set the attribute of boundary element i.
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh....
void Get2DPatchNets(const Vector &coords, int vdim)
void SetSolutionVector(Vector &coords, int vdim)
Return in coords the coordinates from each patch. Side effects: delete the patches and update the wei...
int GetNP() const
Return the number of patches.
int GetNBE() const
Return the number of active boundary elements.
Mode
Flag for indicating what type of NURBS fespace this extension is used for.
@ H_CURL
Extension for a divergence conforming vector-valued space
@ H_DIV
Extension for a standard scalar-valued space
std::vector< Array< int > > kvf_coarse
void InitDofMap()
Set DOF map sizes to 0.
Mesh * patchTopo
Patch topology mesh.
void GetPatches(Array< NURBSPatch * > &patches)
Array< int > ref_factors
Knotvector refinement factors.
void GetCoarseningFactors(Array< int > &f) const
void Generate3DElementDofTable()
void SetPatchAttribute(int i, int attr)
Set the attribute for patch i, which is set to all elements in the patch.
const Array< int > & GetPatchElements(int patch)
Return the array of indices of all elements in patch patch.
std::vector< Array< int > > patch_to_bel
For each patch p, patch_to_bel[p] lists all boundary elements in the patch.
void UniformRefinement(int rf=2)
Refine with optional refinement factor rf. Uniform means refinement is done everywhere by the same fa...
Array< int > p_meshOffsets
int GetGNE() const
Return the global number of elements.
virtual int VertexPairToEdge(const std::pair< int, int > &vertices) const
Given a pair of vertices, return the corresponding edge.
Array< int > mOrders
Orders of all KnotVectors.
void Print(std::ostream &os, const std::string &comments="") const
Writes all patch data to the stream os.
virtual void ReadCoarsePatchCP(std::istream &input)
Read the control points for coarse patches.
int num_structured_patches
Whether patchTopo is a nonconforming mesh.
Table * el_dof
Table of DOFs for each element (el_dof) or boundary element (bel_dof).
void SetPatchBdrAttribute(int i, int attr)
Set the attribute for patch boundary element i to attr, which is set to all boundary elements in the ...
void PrintSolution(const GridFunction &sol, std::ostream &os) const
Write a GridFunction sol patch-by-patch to stream os.
friend class ParNURBSExtension
virtual void GenerateOffsets()
Set the mesh and space offsets, and also count the global NumOfVertices and the global NumOfDofs.
int DofMap(int dof) const
Return the dof index whilst accounting for periodic boundaries.
Array< bool > activeBdrElem
int GetNBP() const
Return the number of boundary patches.
bool own_topo
Whether this object owns patchTopo.
void SetCoordsFromPatches(Vector &Nodes)
Set FE coordinates in Nodes, using data from patches, and erase patches.
void SetOrderFromOrders()
Set overall order mOrder based on KnotVector orders.
Array3D< double > patchCP
Number of structured patches.
void GetElementIJK(int elem, Array< int > &ijk)
Return Cartesian indices (i,j) in 2D or (i,j,k) in 3D of element elem, in the knot-span tensor produc...
void MergeGridFunctions(GridFunction *gf_array[], int num_pieces, GridFunction &merged)
Set the DOFs of merged to values from active elements in num_pieces of Gridfunctions gf_array.
const Vector & GetWeights() const
Access function to the vector of weights weights.
void Set2DSolutionVector(Vector &coords, int vdim)
void Set3DSolutionVector(Vector &coords, int vdim)
void GenerateActiveVertices()
Determine activeVert, NumOfActiveVertices from the activeElem array.
Array< int > el_to_patch
Map from element indices to patch indices.
void Coarsen(int cf=2, real_t tol=1.0e-12)
Coarsen with optional coarsening factor cf.
static constexpr int unsetFactor
Refinement factors in each dimension.
int GetPatchAttribute(int i) const
Get the attribute for patch i, which is set to all elements in the patch.
const Array< int > & GetSlave() const
void Get2DBdrElementTopo(Array< Element * > &boundary) const
void GetElementTopo(Array< Element * > &elements) const
Generate the active mesh elements and return them in elements.
const Array< int > & GetPatchBdrElements(int patch)
Return the array of indices of all boundary elements in patch patch.
void Get1DElementTopo(Array< Element * > &elements) const
Generate the active mesh elements and return them in elements.
int KnotInd(int edge) const
Return the unsigned index of the KnotVector for edge edge.
int GetNKV() const
Return the number of KnotVectors.
void GetVertexLocalToGlobal(Array< int > &lvert_vert)
Get the local to global vertex index map lvert_vert.
void CountBdrElements()
Count the global NumOfBdrElements.
void LoadBE(int i, const FiniteElement *BE) const
Load boundary element i into BE.
void Get2DElementTopo(Array< Element * > &elements) const
Table * GetElementDofTable()
void GenerateElementDofTable()
Based on activeElem, count NumOfActiveDofs and generate el_dof, el_to_patch, el_to_IJK,...
void Generate3DBdrElementDofTable()
int GetGNV() const
Return the global number of vertices.
KnotVector * KnotVec(int edge)
DOF to owning patch map in SetSolutionVector()
bool HavePatches() const
Return true if at least 1 patch is defined, false otherwise.
NCMesh * GetNCMesh() const
Return a pointer to the NCMesh of a nonconforming patch topology mesh.
std::vector< Array< int > > patch_to_el
For each patch p, patch_to_el[p] lists all elements in the patch.
Array< int > v_meshOffsets
Global mesh offsets, meshOffsets == meshVertexOffsets.
NURBSExtension & operator=(const NURBSExtension &)=delete
Copy assignment not supported.
int NumOfActiveVertices
Local entity counts.
void CheckKVDirection(int p, Array< int > &kvdir)
Return the directions in kvdir of the KnotVectors in patch p based on the patch edge orientations....
void GetBdrElementTopo(Array< Element * > &boundary) const
Generate the active mesh boundary elements and return them in boundary.
void SetOrdersFromKnotVectors()
Set orders from KnotVector orders.
Array< KnotVector * > knotVectorsCompr
Comprehensive set of all KnotVectors, one for every edge.
Array2D< int > el_to_IJK
Map from element indices to IJK knot span indices.
void Get1DPatchNets(const Vector &coords, int vdim)
void GenerateBdrElementDofTable()
Call after GenerateElementDofTable to set boundary element DOF table.
Array< int > & GetMaster()
virtual void GetMasterEdgeDofs(bool dof, int me, Array< int > &dofs) const
Get the DOFs (dof = true) or vertices (dof = false) for master edge me.
Array< int > f_spaceOffsets
void CheckPatches()
Throw an error if any patch has an inconsistent edge_to_ukv mapping.
void MergeWeights(Mesh *mesh_array[], int num_pieces)
Set the weights in this object to values from active elements in num_pieces meshes in mesh_array.
int NumOfVertices
Global entity counts.
void Generate2DBdrElementDofTable()
void GetBdrPatchKnotVectors(int bp, Array< KnotVector * > &kv)
Return KnotVectors in kv in each dimension for boundary patch bp.
bool NonconformingPatches() const
Return true if the patch topology mesh is nonconforming.
void ConnectBoundaries2D(int bnd0, int bnd1)
virtual void RefineWithKVFactors(int rf, const std::string &kvf_filename, bool coarsened)
Array2D< int > bel_to_IJK
Array< NURBSPatch * > patches
Array of all patches in the mesh.
virtual bool IsMasterEdge(int edge) const
Return true if edge is a master NC-patch edge.
void GetPatchOffsets(int &meshCounter, int &spaceCounter)
Helper function for GenerateOffsets().
int GetNTotalDof() const
Return the total number of DOFs.
void SetPatchToElements()
Set patch_to_el.
int GetElementPatch(int elem) const
Returns the index of the patch containing element elem.
Array< int > & GetSlave()
void GetPatchNets(const Vector &coords, int vdim)
Set the B-NET on each patch using values from coords.
void ConnectBoundaries3D(int bnd0, int bnd1)
const Array< int > & GetMaster() const
void CountElements()
Count the global NumOfElements.
bool ConsistentKVSets()
Check if the comprehensive array of KnotVectors agrees with the unique set of KnotVectors,...
void Load(std::istream &input, bool spacing)
Load data from file (used by constructor).
void KnotRemove(Array< Vector * > &kv, real_t tol=1.0e-12)
void LoadFE(int i, const FiniteElement *FE) const
Load element i into FE.
void GetElementLocalToGlobal(Array< int > &lelem_elem)
Get the local to global element index map lelem_elem.
virtual void PrintCoarsePatches(std::ostream &os)
Print control points for coarse patches.
void GenerateActiveBdrElems()
Determine activeBdrElem, NumOfActiveBdrElems.
Array< int > d_to_d
Periodic BC info:
int NumOfKnotVectors
Number of unique (not comprehensive) KnotVectors.
Vector weights
Weights for each control point or DOF.
void CreateComprehensiveKV()
Create the comprehensive set of KnotVectors. In 1D, this set is identical to the unique set of KnotVe...
void GetPatchDofs(const int patch, Array< int > &dofs)
Return the degrees of freedom in dofs on patch patch, in Cartesian order.
Array< int > bel_to_patch
Map from boundary element indices to patch indices.
void FullyCoarsen()
Fully coarsen all structured patches, for non-nested refinement of a mesh with a nonconforming patch ...
void GetPatchKnotVectors(int p, Array< KnotVector * > &kv)
Return KnotVectors in kv in each dimension for patch p.
Array< int > edge_to_ukv
Map from patchTopo edge indices to unique KnotVector indices.
Table * GetBdrElementDofTable()
void PrintFunctions(const char *basename, int samples=11) const
Call KnotVector::PrintFunctions for all KnotVectors, using a separate, newly created ofstream with fi...
std::vector< Array< int > > kvf
Control points for coarse structured patches.
void Generate2DElementDofTable()
void Set1DSolutionVector(Vector &coords, int vdim)
int KnotVecNE(int edge) const
Return the number of knotvector elements for edge edge.
void PrintCharacteristics(std::ostream &os) const
Print various mesh characteristics to the stream os.
int GetNDof() const
Return the number of active DOFs.
virtual void GetMasterFaceDofs(bool dof, int mf, Array2D< int > &dofs) const
Get the DOFs (dof = true) or vertices (dof = false) for master face mf.
void KnotInsert(Array< KnotVector * > &kv)
Insert knots from kv into all KnotVectors in all patches. The size of kv should be the same as knotVe...
virtual bool IsMasterFace(int face) const
Return true if face is a master NC-patch face.
int GetOrder() const
If all KnotVector orders are identical, return that number. Otherwise, return NURBSFECollection::Vari...
NURBSExtension * GetCurlExtension(int component)
Array< int > e_meshOffsets
const Array< int > & GetOrders() const
Read-only access to the orders of all KnotVectors.
int GetActiveDof(int glob) const
Return the local DOF number for a given global DOF number glob.
int GetGNBE() const
Return the global number of boundary elements.
int KnotSign(int edge) const
Return the sign (orientation) of the KnotVector for edge edge.
Array< int > dof2patch
Unset refinement factor value.
void ConnectBoundaries1D(int bnd0, int bnd1)
int GetNV() const
Return the local number of active vertices.
void ConvertToPatches(const Vector &Nodes)
Define patches in IKJ (B-net) format, using FE coordinates in Nodes.
void Generate1DBdrElementDofTable()
Generate the table of global DOFs for active boundary elements, and define bel_to_patch,...
void Get3DPatchNets(const Vector &coords, int vdim)
int Dimension() const
Return the dimension of the reference space (not physical space).
Array< int > f_meshOffsets
NURBSExtension * GetDivExtension(int component)
void Get3DBdrElementTopo(Array< Element * > &boundary) const
int mOrder
Order of KnotVectors, see GetOrder() for description.
Mesh GetPatchTopology() const
Returns a deep copy of the patch topology mesh.
void SetKnotsFromPatches()
Set KnotVectors from patches and construct mesh and space data.
Array< KnotVector * > knotVectors
Set of unique KnotVectors.
Array< int > p_spaceOffsets
void Generate1DElementDofTable()
Generate elem_to_global-dof table for the active elements, and define el_to_patch,...
void SetPatchToBdrElements()
Set patch_to_bel.
Array< int > v_spaceOffsets
Global space offsets, spaceOffsets == dofOffsets.
int GetNE() const
Return the number of active elements.
int GetPatchBdrAttribute(int i) const
Get the attribute for boundary patch element i, which is set to all boundary elements in the patch.
void DegreeElevate(int rel_degree, int degree=16)
Call DegreeElevate for all KnotVectors of all patches. For each KnotVector, the new degree is max(old...
const KnotVector * GetKnotVector(int i) const
KnotVector read-only access function.
void LoadSolution(std::istream &input, GridFunction &sol) const
Read a GridFunction sol from stream input, written patch-by-patch, e.g. with PrintSolution().
void ConnectBoundaries()
Set DOF maps for periodic BC.
void CheckBdrPatches()
Throw an error if any boundary patch has invalid KnotVector orientation.
const NURBSPatch * GetPatch(int patch) const
Return NURBSPatch object; returned object should NOT be deleted.
NURBSExtension()
To be used by ParNURBSExtension constructor(s)
void Get1DBdrElementTopo(Array< Element * > &boundary) const
Generate the active mesh boundary elements and return them in boundary.
virtual ~NURBSExtension()
Destroy a NURBSExtension.
Array< int > e_spaceOffsets
void Get3DElementTopo(Array< Element * > &elements) const
Mapping for mesh vertices and NURBS space DOFs on a patch.
NURBSPatchMap(const NURBSExtension *ext)
Constructor for an object associated with NURBSExtension ext.
void SetPatchDofMap(int p, const KnotVector *kv[])
Set NURBS space DOF map for patch p with KnotVectors kv.
int operator[](const int i) const
void SetBdrPatchDofMap(int bp, const KnotVector *kv[], int *okv)
Set NURBS space DOF map for boundary patch bp with KnotVectors kv.
void SetBdrPatchVertexMap(int bp, const KnotVector *kv[], int *okv)
Set mesh vertex map for boundary patch bp with KnotVectors kv.
void SetPatchVertexMap(int p, const KnotVector *kv[])
Set mesh vertex map for patch p with KnotVectors kv.
int operator()(const int i) const
For 1D, return the vertex or DOF at index i.
A NURBS patch can be 1D, 2D, or 3D, and is defined as a tensor product of KnotVectors.
int MakeUniformDegree(int degree=-1)
int GetNKV() const
Return the number of KnotVectors, which is the patch dimension.
friend NURBSPatch * Revolve3D(NURBSPatch &patch, real_t n[], real_t ang, int times)
real_t & operator()(int i, int l)
1D access function. i is a B-NET index, and l is a variable index.
void UpdateSpacingPartitions(const Array< KnotVector * > &pkv)
Update piecewise spacing function partitions to match refined pkv.
void GetCoarseningFactors(Array< int > &f) const
Calls KnotVector::GetCoarseningFactor for each direction.
void Coarsen(int cf=2, real_t tol=1.0e-12)
Coarsen with optional coarsening factor cf which divides the number of elements in each dimension....
int KnotRemove(int dir, real_t knot, int ntimes=1, real_t tol=1.0e-12)
Remove knot with value knot from direction dir.
void Rotate2D(real_t angle)
Rotate the NURBSPatch, 2D case.
NURBSPatch & operator=(const NURBSPatch &)=delete
Copy assignment not supported.
int Dim
Physical dimension plus 1.
void Rotate3D(real_t normal[], real_t angle)
Rotate the NURBSPatch, 3D case.
void KnotInsert(int dir, const KnotVector &knot)
Insert any new knots from knot in direction dir. If the order of knot is higher than the current orde...
void FullyCoarsen(const Array2D< double > &cp, int ncp1D)
Coarsen to a single element.
real_t & slice(int i, int j)
Access function for the effectively 1D flattened net, where i is a knot index, and j is an index of a...
static void Get3DRotationMatrix(real_t n[], real_t angle, real_t r, DenseMatrix &T)
Compute the 3D rotation matrix T for angle angle around axis n (a 3D vector, not necessarily normaliz...
void SwapDirections(int dir1, int dir2)
Swap data and KnotVectors in directions dir1 and dir2.
static void Get2DRotationMatrix(real_t angle, DenseMatrix &T)
Compute the 2D rotation matrix T for angle angle.
~NURBSPatch()
Deletes data and KnotVectors.
int SetLoopDirection(int dir)
Flattens the B-NET in direction dir, producing a 1D net. Returns the number of variables per knot in ...
KnotVector * GetKV(int dir)
int GetNC() const
Return the number of components stored in the NURBSPatch.
void Print(std::ostream &os) const
Writes KnotVectors and data to the stream os.
friend NURBSPatch * Interpolate(NURBSPatch &p1, NURBSPatch &p2)
Given two patches p1 and p2 of the same dimensions, create and return a new patch by merging their kn...
Array< KnotVector * > kv
KnotVectors in each direction.
void UniformRefinement(int rf=2, int multiplicity=1)
Refine with optional refinement factor rf. Uniform means refinement is done everywhere by the same fa...
void FlipDirection(int dir)
Reverse data and knots in direction dir.
void swap(NURBSPatch *np)
Deletes own data, takes data from np, and deletes np.
NURBSPatch(NURBSPatch *parent, int dir, int Order, int NCP)
Copy constructor.
void SetKnotVectorsCoarse(bool c)
Marks the KnotVector in each dimension as coarse.
void Rotate(real_t angle, real_t normal[]=NULL)
Rotate the NURBSPatch in 2D or 3D..
void DegreeElevate(int dir, int t)
Increase the order in direction dir by t >= 0.
real_t * data
Data with the layout (Dim x ni x nj x nk)
Parallel version of NURBSExtension.
Table stores the connectivity of elements of TYPE I to elements of TYPE II. For example,...
int Size() const
Returns the size of the vector.
real_t u(const Vector &xvec)
void mfem_error(const char *msg)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
real_t p(const Vector &x, real_t t)