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)); }
105 inline const double &
operator()(
int i,
int j)
const;
123 void Print(std::ostream &
out)
const;
141 inline double &
operator()(
int i,
int j,
int l);
142 inline const double &
operator()(
int i,
int j,
int l)
const;
144 inline double &
operator()(
int i,
int j,
int k,
int l);
145 inline const double &
operator()(
int i,
int j,
int k,
int l)
const;
151 void Rotate3D(
double normal[],
double angle);
160 class ParNURBSExtension;
222 inline int KnotInd(
int edge)
const;
340 void Print(std::ostream &
out)
const;
415 Table *GetGlobalElementDofTable();
416 Table *Get2DGlobalElementDofTable();
417 Table *Get3DGlobalElementDofTable();
419 void SetActive(
const int *partitioning,
const Array<bool> &active_bel);
420 void BuildGroups(
const int *partitioning,
const Table &elem_dof);
448 int I, J, K, pOffset, opatch;
451 inline static int F(
const int n,
const int N)
452 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
454 inline static int Or1D(
const int n,
const int N,
const int Or)
455 {
return (Or > 0) ? n : (N - 1 - n); }
457 inline static int Or2D(
const int n1,
const int n2,
458 const int N1,
const int N2,
const int Or);
461 void GetPatchKnotVectors (
int p,
const KnotVector *kv[]);
462 void GetBdrPatchKnotVectors(
int p,
const KnotVector *kv[],
int *okv);
467 int nx() {
return I + 1; }
468 int ny() {
return J + 1; }
469 int nz() {
return K + 1; }
478 inline int operator[](
const int i)
const {
return (*
this)(i); }
480 inline int operator()(
const int i,
const int j)
const;
482 inline int operator()(
const int i,
const int j,
const int k)
const;
501 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
514 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
517 mfem_error(
"NURBSPatch::operator() const 2D");
527 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
528 k >=
nk || l < 0 || l >=
Dim)
540 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
541 k >=
nk || l < 0 || l >=
Dim)
543 mfem_error(
"NURBSPatch::operator() const 3D");
554 return (kv >= 0) ? kv : (-1-kv);
585 inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
586 const int N1,
const int N2,
const int Or)
591 case 0:
return n1 + n2*N1;
592 case 1:
return n2 + n1*N2;
593 case 2:
return n2 + (N1 - 1 - n1)*N2;
594 case 3:
return (N1 - 1 - n1) + n2*N1;
595 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
596 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
597 case 6:
return (N2 - 1 - n2) + n1*N2;
598 case 7:
return n1 + (N2 - 1 - n2)*N1;
608 const int i1 = i - 1;
611 case 0:
return verts[0];
612 case 1:
return pOffset + Or1D(i1, I, opatch);
613 case 2:
return verts[1];
616 mfem_error(
"NURBSPatchMap::operator() const 1D");
623 const int i1 = i - 1, j1 = j - 1;
624 switch (3*F(j1, J) + F(i1, I))
626 case 0:
return verts[0];
627 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
628 case 2:
return verts[1];
629 case 3:
return edges[3] + Or1D(j1, J, -oedge[3]);
630 case 4:
return pOffset + Or2D(i1, j1, I, J, opatch);
631 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
632 case 6:
return verts[3];
633 case 7:
return edges[2] + Or1D(i1, I, -oedge[2]);
634 case 8:
return verts[2];
637 mfem_error(
"NURBSPatchMap::operator() const 2D");
646 const int i1 = i - 1, j1 = j - 1, k1 = k - 1;
647 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
649 case 0:
return verts[0];
650 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
651 case 2:
return verts[1];
652 case 3:
return edges[3] + Or1D(j1, J, oedge[3]);
653 case 4:
return faces[0] + Or2D(i1, J - 1 - j1, I, J, oface[0]);
654 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
655 case 6:
return verts[3];
656 case 7:
return edges[2] + Or1D(i1, I, oedge[2]);
657 case 8:
return verts[2];
658 case 9:
return edges[8] + Or1D(k1, K, oedge[8]);
659 case 10:
return faces[1] + Or2D(i1, k1, I, K, oface[1]);
660 case 11:
return edges[9] + Or1D(k1, K, oedge[9]);
661 case 12:
return faces[4] + Or2D(J - 1 - j1, k1, J, K, oface[4]);
662 case 13:
return pOffset + I*(J*k1 + j1) + i1;
663 case 14:
return faces[2] + Or2D(j1, k1, J, K, oface[2]);
664 case 15:
return edges[11] + Or1D(k1, K, oedge[11]);
665 case 16:
return faces[3] + Or2D(I - 1 - i1, k1, I, K, oface[3]);
666 case 17:
return edges[10] + Or1D(k1, K, oedge[10]);
667 case 18:
return verts[4];
668 case 19:
return edges[4] + Or1D(i1, I, oedge[4]);
669 case 20:
return verts[5];
670 case 21:
return edges[7] + Or1D(j1, J, oedge[7]);
671 case 22:
return faces[5] + Or2D(i1, j1, I, J, oface[5]);
672 case 23:
return edges[5] + Or1D(j1, J, oedge[5]);
673 case 24:
return verts[7];
674 case 25:
return edges[6] + Or1D(i1, I, oedge[6]);
675 case 26:
return verts[6];
678 mfem_error(
"NURBSPatchMap::operator() const 3D");
Array< KnotVector * > knotVectors
Abstract class for all 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
int Size() const
Return the logical size of the array.
void SetCoordsFromPatches(Vector &Nodes)
void ConnectBoundaries2D(int bnd0, int bnd1)
KnotVector * KnotVec(int edge)
const Vector & GetWeights() const
void swap(NURBSPatch *np)
const Array< int > & GetMaster() const
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()
NURBSExtension & operator=(const NURBSExtension &)=delete
Copy assignment not supported.
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.
Array< int > & GetSlave()
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)
Array< int > & GetMaster()
void SwapDirections(int dir1, int dir2)
KnotVector()
Create KnotVector.
static const int MaxOrder
Array< int > v_spaceOffsets
void UniformRefinement(Vector &newknots) const
const Array< int > & GetSlave() const
void Generate2DBdrElementDofTable()
void ConnectBoundaries3D(int bnd0, int bnd1)
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)
double p(const Vector &x, double t)
void Print(std::ostream &out) const
void LoadFE(int i, const FiniteElement *FE) const
int DofMap(int dof) 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 CalcD2Shape(Vector &grad2, int i, double xi) const
void CalcShape(Vector &shape, int i, double xi) const
void CalcDnShape(Vector &gradn, int n, int i, double xi) const
void PrintFunctions(std::ostream &out, int samples=11) 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
NURBSPatch & operator=(const NURBSPatch &)=delete
int operator[](const int i) const
void Print(std::ostream &out) const
double getKnotLocation(double xi, int ni) const
void PrintFunctions(const char *filename, int samples=11) const
double u(const Vector &xvec)
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)