15 #include "../config/config.hpp"
16 #include "../general/table.hpp"
17 #include "../linalg/vector.hpp"
21 #include "../general/communication.hpp"
60 {
return (xi*
knot(ni+1) + (1. - xi)*
knot(ni)); }
100 inline const double &
operator()(
int i,
int j)
const;
116 void Print(std::ostream &
out)
const;
132 inline double &
operator()(
int i,
int j,
int l);
133 inline const double &
operator()(
int i,
int j,
int l)
const;
135 inline double &
operator()(
int i,
int j,
int k,
int l);
136 inline const double &
operator()(
int i,
int j,
int k,
int l)
const;
142 void Rotate3D(
double normal[],
double angle);
151 class ParNURBSExtension;
206 inline int KnotInd(
int edge)
const;
305 void Print(std::ostream &
out)
const;
378 Table *GetGlobalElementDofTable();
379 Table *Get2DGlobalElementDofTable();
380 Table *Get3DGlobalElementDofTable();
382 void SetActive(
const int *partitioning,
const Array<bool> &active_bel);
383 void BuildGroups(
const int *partitioning,
const Table &elem_dof);
411 int I, J, K, pOffset, opatch;
414 inline static int F(
const int n,
const int N)
415 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
417 inline static int Or1D(
const int n,
const int N,
const int Or)
418 {
return (Or > 0) ? n : (N - 1 - n); }
420 inline static int Or2D(
const int n1,
const int n2,
421 const int N1,
const int N2,
const int Or);
424 void GetPatchKnotVectors (
int p,
const KnotVector *kv[]);
425 void GetBdrPatchKnotVectors(
int p,
const KnotVector *kv[],
int *okv);
430 int nx() {
return I + 1; }
431 int ny() {
return J + 1; }
432 int nz() {
return K + 1; }
441 inline int operator[](
const int i)
const {
return (*
this)(i); }
443 inline int operator()(
const int i,
const int j)
const;
445 inline int operator()(
const int i,
const int j,
const int k)
const;
464 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
477 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
480 mfem_error(
"NURBSPatch::operator() const 2D");
490 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
491 k >=
nk || l < 0 || l >=
Dim)
503 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
504 k >=
nk || l < 0 || l >=
Dim)
506 mfem_error(
"NURBSPatch::operator() const 3D");
517 return (kv >= 0) ? kv : (-1-kv);
548 inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
549 const int N1,
const int N2,
const int Or)
554 case 0:
return n1 + n2*N1;
555 case 1:
return n2 + n1*N2;
556 case 2:
return n2 + (N1 - 1 - n1)*N2;
557 case 3:
return (N1 - 1 - n1) + n2*N1;
558 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
559 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
560 case 6:
return (N2 - 1 - n2) + n1*N2;
561 case 7:
return n1 + (N2 - 1 - n2)*N1;
571 const int i1 = i - 1;
574 case 0:
return verts[0];
575 case 1:
return pOffset + Or1D(i1, I, opatch);
576 case 2:
return verts[1];
579 mfem_error(
"NURBSPatchMap::operator() const 1D");
586 const int i1 = i - 1, j1 = j - 1;
587 switch (3*F(j1, J) + F(i1, I))
589 case 0:
return verts[0];
590 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
591 case 2:
return verts[1];
592 case 3:
return edges[3] + Or1D(j1, J, -oedge[3]);
593 case 4:
return pOffset + Or2D(i1, j1, I, J, opatch);
594 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
595 case 6:
return verts[3];
596 case 7:
return edges[2] + Or1D(i1, I, -oedge[2]);
597 case 8:
return verts[2];
600 mfem_error(
"NURBSPatchMap::operator() const 2D");
609 const int i1 = i - 1, j1 = j - 1, k1 = k - 1;
610 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
612 case 0:
return verts[0];
613 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
614 case 2:
return verts[1];
615 case 3:
return edges[3] + Or1D(j1, J, oedge[3]);
616 case 4:
return faces[0] + Or2D(i1, J - 1 - j1, I, J, oface[0]);
617 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
618 case 6:
return verts[3];
619 case 7:
return edges[2] + Or1D(i1, I, oedge[2]);
620 case 8:
return verts[2];
621 case 9:
return edges[8] + Or1D(k1, K, oedge[8]);
622 case 10:
return faces[1] + Or2D(i1, k1, I, K, oface[1]);
623 case 11:
return edges[9] + Or1D(k1, K, oedge[9]);
624 case 12:
return faces[4] + Or2D(J - 1 - j1, k1, J, K, oface[4]);
625 case 13:
return pOffset + I*(J*k1 + j1) + i1;
626 case 14:
return faces[2] + Or2D(j1, k1, J, K, oface[2]);
627 case 15:
return edges[11] + Or1D(k1, K, oedge[11]);
628 case 16:
return faces[3] + Or2D(I - 1 - i1, k1, I, K, oface[3]);
629 case 17:
return edges[10] + Or1D(k1, K, oedge[10]);
630 case 18:
return verts[4];
631 case 19:
return edges[4] + Or1D(i1, I, oedge[4]);
632 case 20:
return verts[5];
633 case 21:
return edges[7] + Or1D(j1, J, oedge[7]);
634 case 22:
return faces[5] + Or2D(i1, j1, I, J, oface[5]);
635 case 23:
return edges[5] + Or1D(j1, J, oedge[5]);
636 case 24:
return verts[7];
637 case 25:
return edges[6] + Or1D(i1, I, oedge[6]);
638 case 26:
return verts[6];
641 mfem_error(
"NURBSPatchMap::operator() const 3D");
Array< KnotVector * > knotVectors
Abstract class for Finite Elements.
Array< int > f_meshOffsets
KnotVector * DegreeElevate(int t) const
NURBSPatch(NURBSPatch *parent, int dir, int Order, int NCP)
Array2D< int > bel_to_IJK
void SetCoordsFromPatches(Vector &Nodes)
KnotVector * KnotVec(int edge)
const Vector & GetWeights() const
void swap(NURBSPatch *np)
Class for grid function - Vector with associated FE space.
void DegreeElevate(int dir, int t)
void LoadBE(int i, const FiniteElement *BE) const
void Generate2DElementDofTable()
int KnotInd(int edge) const
void MergeGridFunctions(GridFunction *gf_array[], int num_pieces, GridFunction &merged)
virtual ~ParNURBSExtension()
void Generate3DElementDofTable()
void KnotInsert(int dir, const KnotVector &knot)
void MergeWeights(Mesh *mesh_array[], int num_pieces)
int GetNBE() const
Returns number of boundary elements.
void Get3DBdrElementTopo(Array< Element * > &boundary) const
NURBSPatchMap(const NURBSExtension *ext)
void Rotate3D(double normal[], double angle)
Array< int > e_meshOffsets
int operator()(const int i) const
void GetElements()
Count the number of elements.
void SetOrdersFromKnotVectors()
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
void Generate3DBdrElementDofTable()
int GetNE() const
Returns number of elements.
Array< int > e_spaceOffsets
void GenerateBdrElementDofTable()
const KnotVector * GetKnotVector(int i) const
void GetElementLocalToGlobal(Array< int > &lelem_elem)
Array< int > edge_to_knot
void GenerateActiveVertices()
void GetVertexLocalToGlobal(Array< int > &lvert_vert)
void Set2DSolutionVector(Vector &Nodes, int vdim)
friend NURBSPatch * Revolve3D(NURBSPatch &patch, double n[], double ang, int times)
void SwapDirections(int dir1, int dir2)
KnotVector()
Create KnotVector.
static const int MaxOrder
Array< int > v_spaceOffsets
void UniformRefinement(Vector &newknots) const
void Generate2DBdrElementDofTable()
ParNURBSExtension(const ParNURBSExtension &orig)
void Set3DSolutionVector(Vector &Nodes, int vdim)
void GetPatchKnotVectors(int p, Array< KnotVector * > &kv)
void GenerateActiveBdrElems()
void PrintSolution(const GridFunction &sol, std::ostream &out) const
void Get3DPatchNets(const Vector &Nodes, int vdim)
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void Get2DPatchNets(const Vector &Nodes, int vdim)
virtual ~NURBSExtension()
Destroy a NURBSExtension.
friend NURBSPatch * Interpolate(NURBSPatch &p1, NURBSPatch &p2)
void GetBdrElementTopo(Array< Element * > &boundary) const
static void Get3DRotationMatrix(double n[], double angle, double r, DenseMatrix &T)
void SetKnotsFromPatches()
void GetElementTopo(Array< Element * > &elements) const
const Array< int > & GetOrders() const
Read-only access to the orders of all knot vectors.
Array< int > f_spaceOffsets
Array< bool > activeBdrElem
void LoadSolution(std::istream &input, GridFunction &sol) const
KnotVector(const KnotVector &kv)
int GetOrder() const
If all orders are identical, return that number. Otherwise, return NURBSFECollection::VariableOrder.
KnotVector * GetKV(int i)
void Print(std::ostream &out) const
void LoadFE(int i, const FiniteElement *FE) const
Array< int > v_meshOffsets
void SetBdrPatchVertexMap(int p, const KnotVector *kv[], int *okv)
void GetBdrPatchKnotVectors(int p, Array< KnotVector * > &kv)
Array< int > p_meshOffsets
KnotVector & operator=(const KnotVector &kv)
void SetPatchVertexMap(int p, const KnotVector *kv[])
Table * GetElementDofTable()
Table * GetBdrElementDofTable()
void SetOrderFromOrders()
void CalcShape(Vector &shape, int i, double xi) const
void GetPatchNets(const Vector &Nodes, int vdim)
int MakeUniformDegree(int degree=-1)
bool isElement(int i) const
Array< int > p_spaceOffsets
void SetSolutionVector(Vector &Nodes, int vdim)
void Get3DElementTopo(Array< Element * > &elements) const
int findKnotSpan(double u) const
void SetBdrPatchDofMap(int p, const KnotVector *kv[], int *okv)
double & operator()(int i, int j)
void GenerateElementDofTable()
Array< NURBSPatch * > patches
const double & operator[](int i) const
void PrintCharacteristics(std::ostream &out) const
~KnotVector()
Destroys KnotVector.
void Difference(const KnotVector &kv, Vector &diff) const
int operator[](const int i) const
void Print(std::ostream &out) const
double getKnotLocation(double xi, int ni) const
void CalcDShape(Vector &grad, int i, double xi) const
void DegreeElevate(int rel_degree, int degree=16)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
double & operator[](int i)
void FlipDirection(int dir)
void Get2DElementTopo(Array< Element * > &elements) const
Array< int > bel_to_patch
void SetPatchDofMap(int p, const KnotVector *kv[])
void ConvertToPatches(const Vector &Nodes)
void KnotInsert(Array< KnotVector * > &kv)
void Print(std::ostream &out) const
void Get2DBdrElementTopo(Array< Element * > &boundary) const
int SetLoopDirection(int dir)