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;
213 inline int KnotInd(
int edge)
const;
328 void Print(std::ostream &
out)
const;
401 Table *GetGlobalElementDofTable();
402 Table *Get2DGlobalElementDofTable();
403 Table *Get3DGlobalElementDofTable();
405 void SetActive(
const int *partitioning,
const Array<bool> &active_bel);
406 void BuildGroups(
const int *partitioning,
const Table &elem_dof);
434 int I, J, K, pOffset, opatch;
437 inline static int F(
const int n,
const int N)
438 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
440 inline static int Or1D(
const int n,
const int N,
const int Or)
441 {
return (Or > 0) ? n : (N - 1 - n); }
443 inline static int Or2D(
const int n1,
const int n2,
444 const int N1,
const int N2,
const int Or);
447 void GetPatchKnotVectors (
int p,
const KnotVector *kv[]);
448 void GetBdrPatchKnotVectors(
int p,
const KnotVector *kv[],
int *okv);
453 int nx() {
return I + 1; }
454 int ny() {
return J + 1; }
455 int nz() {
return K + 1; }
464 inline int operator[](
const int i)
const {
return (*
this)(i); }
466 inline int operator()(
const int i,
const int j)
const;
468 inline int operator()(
const int i,
const int j,
const int k)
const;
487 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
500 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
503 mfem_error(
"NURBSPatch::operator() const 2D");
513 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
514 k >=
nk || l < 0 || l >=
Dim)
526 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
527 k >=
nk || l < 0 || l >=
Dim)
529 mfem_error(
"NURBSPatch::operator() const 3D");
540 return (kv >= 0) ? kv : (-1-kv);
571 inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
572 const int N1,
const int N2,
const int Or)
577 case 0:
return n1 + n2*N1;
578 case 1:
return n2 + n1*N2;
579 case 2:
return n2 + (N1 - 1 - n1)*N2;
580 case 3:
return (N1 - 1 - n1) + n2*N1;
581 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
582 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
583 case 6:
return (N2 - 1 - n2) + n1*N2;
584 case 7:
return n1 + (N2 - 1 - n2)*N1;
594 const int i1 = i - 1;
597 case 0:
return verts[0];
598 case 1:
return pOffset + Or1D(i1, I, opatch);
599 case 2:
return verts[1];
602 mfem_error(
"NURBSPatchMap::operator() const 1D");
609 const int i1 = i - 1, j1 = j - 1;
610 switch (3*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 pOffset + Or2D(i1, j1, I, J, opatch);
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];
623 mfem_error(
"NURBSPatchMap::operator() const 2D");
632 const int i1 = i - 1, j1 = j - 1, k1 = k - 1;
633 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
635 case 0:
return verts[0];
636 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
637 case 2:
return verts[1];
638 case 3:
return edges[3] + Or1D(j1, J, oedge[3]);
639 case 4:
return faces[0] + Or2D(i1, J - 1 - j1, I, J, oface[0]);
640 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
641 case 6:
return verts[3];
642 case 7:
return edges[2] + Or1D(i1, I, oedge[2]);
643 case 8:
return verts[2];
644 case 9:
return edges[8] + Or1D(k1, K, oedge[8]);
645 case 10:
return faces[1] + Or2D(i1, k1, I, K, oface[1]);
646 case 11:
return edges[9] + Or1D(k1, K, oedge[9]);
647 case 12:
return faces[4] + Or2D(J - 1 - j1, k1, J, K, oface[4]);
648 case 13:
return pOffset + I*(J*k1 + j1) + i1;
649 case 14:
return faces[2] + Or2D(j1, k1, J, K, oface[2]);
650 case 15:
return edges[11] + Or1D(k1, K, oedge[11]);
651 case 16:
return faces[3] + Or2D(I - 1 - i1, k1, I, K, oface[3]);
652 case 17:
return edges[10] + Or1D(k1, K, oedge[10]);
653 case 18:
return verts[4];
654 case 19:
return edges[4] + Or1D(i1, I, oedge[4]);
655 case 20:
return verts[5];
656 case 21:
return edges[7] + Or1D(j1, J, oedge[7]);
657 case 22:
return faces[5] + Or2D(i1, j1, I, J, oface[5]);
658 case 23:
return edges[5] + Or1D(j1, J, oedge[5]);
659 case 24:
return verts[7];
660 case 25:
return edges[6] + Or1D(i1, I, oedge[6]);
661 case 26:
return verts[6];
664 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
int Size() const
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()
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)
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 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)