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)); }
75 void Print(std::ostream &out)
const;
100 inline const double &
operator()(
int i,
int j)
const;
114 void Print(std::ostream &out);
127 inline double &
operator()(
int i,
int j,
int l);
128 inline const double &
operator()(
int i,
int j,
int l)
const;
130 inline double &
operator()(
int i,
int j,
int k,
int l);
131 inline const double &
operator()(
int i,
int j,
int k,
int l)
const;
137 void Rotate3D(
double normal[],
double angle);
146 class ParNURBSExtension;
281 void Print(std::ostream &out)
const;
342 Table *GetGlobalElementDofTable();
343 Table *Get2DGlobalElementDofTable();
344 Table *Get3DGlobalElementDofTable();
346 void SetActive(
int *partitioning,
const Array<bool> &active_bel);
347 void BuildGroups(
int *partitioning,
const Table &elem_dof);
371 int I, J, K, pOffset, opatch;
374 inline static int F(
const int n,
const int N)
375 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
377 inline static int Or1D(
const int n,
const int N,
const int Or)
378 {
return (Or > 0) ? n : (N - 1 - n); }
380 inline static int Or2D(
const int n1,
const int n2,
381 const int N1,
const int N2,
const int Or);
384 void GetPatchKnotVectors (
int p,
KnotVector *kv[]);
385 void GetBdrPatchKnotVectors(
int p,
KnotVector *kv[],
int *okv);
390 int nx() {
return I + 1; }
391 int ny() {
return J + 1; }
392 int nz() {
return K + 1; }
401 inline int operator[](
const int i)
const {
return (*
this)(i); }
403 inline int operator()(
const int i,
const int j)
const;
405 inline int operator()(
const int i,
const int j,
const int k)
const;
424 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
437 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
440 mfem_error(
"NURBSPatch::operator() const 2D");
450 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
451 k >=
nk || l < 0 || l >=
Dim)
463 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
464 k >=
nk || l < 0 || l >=
Dim)
466 mfem_error(
"NURBSPatch::operator() const 3D");
477 return (kv >= 0) ? kv : (-1-kv);
501 inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
502 const int N1,
const int N2,
const int Or)
507 case 0:
return n1 + n2*N1;
508 case 1:
return n2 + n1*N2;
509 case 2:
return n2 + (N1 - 1 - n1)*N2;
510 case 3:
return (N1 - 1 - n1) + n2*N1;
511 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
512 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
513 case 6:
return (N2 - 1 - n2) + n1*N2;
514 case 7:
return n1 + (N2 - 1 - n2)*N1;
527 case 0:
return verts[0];
528 case 1:
return pOffset + Or1D(i1, I, opatch);
529 case 2:
return verts[1];
532 mfem_error(
"NURBSPatchMap::operator() const 1D");
539 int i1 = i - 1, j1 = j - 1;
540 switch (3*F(j1, J) + F(i1, I))
542 case 0:
return verts[0];
543 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
544 case 2:
return verts[1];
545 case 3:
return edges[3] + Or1D(j1, J, -oedge[3]);
546 case 4:
return pOffset + Or2D(i1, j1, I, J, opatch);
547 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
548 case 6:
return verts[3];
549 case 7:
return edges[2] + Or1D(i1, I, -oedge[2]);
550 case 8:
return verts[2];
553 mfem_error(
"NURBSPatchMap::operator() const 2D");
562 int i1 = i - 1, j1 = j - 1, k1 = k - 1;
563 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
565 case 0:
return verts[0];
566 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
567 case 2:
return verts[1];
568 case 3:
return edges[3] + Or1D(j1, J, oedge[3]);
569 case 4:
return faces[0] + Or2D(i1, J - 1 - j1, I, J, oface[0]);
570 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
571 case 6:
return verts[3];
572 case 7:
return edges[2] + Or1D(i1, I, oedge[2]);
573 case 8:
return verts[2];
574 case 9:
return edges[8] + Or1D(k1, K, oedge[8]);
575 case 10:
return faces[1] + Or2D(i1, k1, I, K, oface[1]);
576 case 11:
return edges[9] + Or1D(k1, K, oedge[9]);
577 case 12:
return faces[4] + Or2D(J - 1 - j1, k1, J, K, oface[4]);
578 case 13:
return pOffset + I*(J*k1 + j1) + i1;
579 case 14:
return faces[2] + Or2D(j1, k1, J, K, oface[2]);
580 case 15:
return edges[11] + Or1D(k1, K, oedge[11]);
581 case 16:
return faces[3] + Or2D(I - 1 - i1, k1, I, K, oface[3]);
582 case 17:
return edges[10] + Or1D(k1, K, oedge[10]);
583 case 18:
return verts[4];
584 case 19:
return edges[4] + Or1D(i1, I, oedge[4]);
585 case 20:
return verts[5];
586 case 21:
return edges[7] + Or1D(j1, J, oedge[7]);
587 case 22:
return faces[5] + Or2D(i1, j1, I, J, oface[5]);
588 case 23:
return edges[5] + Or1D(j1, J, oedge[5]);
589 case 24:
return verts[7];
590 case 25:
return edges[6] + Or1D(i1, I, oedge[6]);
591 case 26:
return verts[6];
594 mfem_error(
"NURBSPatchMap::operator() const 3D");
Array< KnotVector * > knotVectors
Abstract class for Finite Elements.
Array< int > f_meshOffsets
KnotVector * DegreeElevate(int t) const
void Get3DPatchNets(const Vector &Nodes)
void Set3DSolutionVector(Vector &Nodes)
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)
void Get2DBdrElementTopo(Array< Element * > &boundary)
Class for grid function - Vector with associated FE space.
void DegreeElevate(int dir, int t)
void SetPatchDofMap(int p, KnotVector *kv[])
void Generate2DElementDofTable()
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.
NURBSPatchMap(NURBSExtension *ext)
void Print(std::ostream &out)
void Rotate3D(double normal[], double angle)
Array< int > e_meshOffsets
int operator()(const int i) const
void GetElements()
Count the number of elements.
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
void GetPatchNets(const Vector &Nodes)
void Generate3DBdrElementDofTable()
int GetNE() const
Returns number of elements.
Array< int > e_spaceOffsets
void GenerateBdrElementDofTable()
const KnotVector * GetKnotVector(int i) const
void Get2DElementTopo(Array< Element * > &elements)
void GetElementLocalToGlobal(Array< int > &lelem_elem)
Array< int > edge_to_knot
void GenerateActiveVertices()
void GetVertexLocalToGlobal(Array< int > &lvert_vert)
friend NURBSPatch * Revolve3D(NURBSPatch &patch, double n[], double ang, int times)
void SetBdrPatchVertexMap(int p, KnotVector *kv[], int *okv)
void SwapDirections(int dir1, int dir2)
void Get3DElementTopo(Array< Element * > &elements)
KnotVector()
Create KnotVector.
void Get3DBdrElementTopo(Array< Element * > &boundary)
static const int MaxOrder
Array< int > v_spaceOffsets
void UniformRefinement(Vector &newknots) const
void LoadFE(int i, const FiniteElement *FE)
void GetBdrElementTopo(Array< Element * > &boundary)
void GetElementTopo(Array< Element * > &elements)
void Generate2DBdrElementDofTable()
void GetPatchKnotVectors(int p, Array< KnotVector * > &kv)
void GenerateActiveBdrElems()
virtual ~NURBSExtension()
Destroy a NURBSExtension.
friend NURBSPatch * Interpolate(NURBSPatch &p1, NURBSPatch &p2)
static void Get3DRotationMatrix(double n[], double angle, double r, DenseMatrix &T)
void SetKnotsFromPatches()
void CalcShape(Vector &shape, int i, double xi)
Array< int > f_spaceOffsets
Array< bool > activeBdrElem
KnotVector(const KnotVector &kv)
KnotVector * GetKV(int i)
Array< int > v_meshOffsets
void mfem_error(const char *msg)
void GetBdrPatchKnotVectors(int p, Array< KnotVector * > &kv)
Array< int > p_meshOffsets
KnotVector & operator=(const KnotVector &kv)
void Set2DSolutionVector(Vector &Nodes)
Table * GetElementDofTable()
Table * GetBdrElementDofTable()
ParNURBSExtension(MPI_Comm comm, NURBSExtension *parent, int *partitioning, const Array< bool > &active_bel)
bool isElement(int i) const
Array< int > p_spaceOffsets
int findKnotSpan(double u) const
double & operator()(int i, int j)
void GenerateElementDofTable()
Array< NURBSPatch * > patches
const double & operator[](int i) const
void SetBdrPatchDofMap(int p, KnotVector *kv[], int *okv)
~KnotVector()
Destroys KnotVector.
void Difference(const KnotVector &kv, Vector &diff) const
void CalcDShape(Vector &grad, int i, double xi)
void DegreeElevate(int t)
void Get2DPatchNets(const Vector &Nodes)
int operator[](const int i) const
void LoadBE(int i, const FiniteElement *BE)
void Print(std::ostream &out) const
double getKnotLocation(double xi, int ni) const
void PrintCharacteristics(std::ostream &out)
double & operator[](int i)
void SetPatchVertexMap(int p, KnotVector *kv[])
void FlipDirection(int dir)
void SetSolutionVector(Vector &Nodes)
Array< int > bel_to_patch
void ConvertToPatches(const Vector &Nodes)
void KnotInsert(Array< KnotVector * > &kv)
void Print(std::ostream &out) const
int SetLoopDirection(int dir)