15 #include "../config/config.hpp"
16 #include "../general/table.hpp"
17 #include "../general/communication.hpp"
18 #include "../linalg/vector.hpp"
58 {
return (xi*
knot(ni+1) + (1. - xi)*
knot(ni)); }
73 void Print(std::ostream &out)
const;
98 inline const double &
operator()(
int i,
int j)
const;
112 void Print(std::ostream &out);
125 inline double &
operator()(
int i,
int j,
int l);
126 inline const double &
operator()(
int i,
int j,
int l)
const;
128 inline double &
operator()(
int i,
int j,
int k,
int l);
129 inline const double &
operator()(
int i,
int j,
int k,
int l)
const;
135 void Rotate3D(
double normal[],
double angle);
144 class ParNURBSExtension;
279 void Print(std::ostream &out)
const;
340 Table *GetGlobalElementDofTable();
341 Table *Get2DGlobalElementDofTable();
342 Table *Get3DGlobalElementDofTable();
344 void SetActive(
int *partitioning,
const Array<bool> &active_bel);
345 void BuildGroups(
int *partitioning,
const Table &elem_dof);
369 int I, J, K, pOffset, opatch;
372 inline static int F(
const int n,
const int N)
373 {
return (n < 0) ? 0 : ((n >= N) ? 2 : 1); }
375 inline static int Or1D(
const int n,
const int N,
const int Or)
376 {
return (Or > 0) ? n : (N - 1 - n); }
378 inline static int Or2D(
const int n1,
const int n2,
379 const int N1,
const int N2,
const int Or);
382 void GetPatchKnotVectors (
int p,
KnotVector *kv[]);
383 void GetBdrPatchKnotVectors(
int p,
KnotVector *kv[],
int *okv);
388 int nx() {
return I + 1; }
389 int ny() {
return J + 1; }
390 int nz() {
return K + 1; }
399 inline int operator[](
const int i)
const {
return (*
this)(i); }
401 inline int operator()(
const int i,
const int j)
const;
403 inline int operator()(
const int i,
const int j,
const int k)
const;
422 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
435 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj ||
nk > 0 ||
438 mfem_error(
"NURBSPatch::operator() const 2D");
448 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
449 k >=
nk || l < 0 || l >=
Dim)
461 if (
data == 0 || i < 0 || i >=
ni || j < 0 || j >=
nj || k < 0 ||
462 k >=
nk || l < 0 || l >=
Dim)
464 mfem_error(
"NURBSPatch::operator() const 3D");
475 return (kv >= 0) ? kv : (-1-kv);
499 inline int NURBSPatchMap::Or2D(
const int n1,
const int n2,
500 const int N1,
const int N2,
const int Or)
505 case 0:
return n1 + n2*N1;
506 case 1:
return n2 + n1*N2;
507 case 2:
return n2 + (N1 - 1 - n1)*N2;
508 case 3:
return (N1 - 1 - n1) + n2*N1;
509 case 4:
return (N1 - 1 - n1) + (N2 - 1 - n2)*N1;
510 case 5:
return (N2 - 1 - n2) + (N1 - 1 - n1)*N2;
511 case 6:
return (N2 - 1 - n2) + n1*N2;
512 case 7:
return n1 + (N2 - 1 - n2)*N1;
525 case 0:
return verts[0];
526 case 1:
return pOffset + Or1D(i1, I, opatch);
527 case 2:
return verts[1];
530 mfem_error(
"NURBSPatchMap::operator() const 1D");
537 int i1 = i - 1, j1 = j - 1;
538 switch (3*F(j1, J) + F(i1, I))
540 case 0:
return verts[0];
541 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
542 case 2:
return verts[1];
543 case 3:
return edges[3] + Or1D(j1, J, -oedge[3]);
544 case 4:
return pOffset + Or2D(i1, j1, I, J, opatch);
545 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
546 case 6:
return verts[3];
547 case 7:
return edges[2] + Or1D(i1, I, -oedge[2]);
548 case 8:
return verts[2];
551 mfem_error(
"NURBSPatchMap::operator() const 2D");
560 int i1 = i - 1, j1 = j - 1, k1 = k - 1;
561 switch (3*(3*F(k1, K) + F(j1, J)) + F(i1, I))
563 case 0:
return verts[0];
564 case 1:
return edges[0] + Or1D(i1, I, oedge[0]);
565 case 2:
return verts[1];
566 case 3:
return edges[3] + Or1D(j1, J, oedge[3]);
567 case 4:
return faces[0] + Or2D(i1, J - 1 - j1, I, J, oface[0]);
568 case 5:
return edges[1] + Or1D(j1, J, oedge[1]);
569 case 6:
return verts[3];
570 case 7:
return edges[2] + Or1D(i1, I, oedge[2]);
571 case 8:
return verts[2];
572 case 9:
return edges[8] + Or1D(k1, K, oedge[8]);
573 case 10:
return faces[1] + Or2D(i1, k1, I, K, oface[1]);
574 case 11:
return edges[9] + Or1D(k1, K, oedge[9]);
575 case 12:
return faces[4] + Or2D(J - 1 - j1, k1, J, K, oface[4]);
576 case 13:
return pOffset + I*(J*k1 + j1) + i1;
577 case 14:
return faces[2] + Or2D(j1, k1, J, K, oface[2]);
578 case 15:
return edges[11] + Or1D(k1, K, oedge[11]);
579 case 16:
return faces[3] + Or2D(I - 1 - i1, k1, I, K, oface[3]);
580 case 17:
return edges[10] + Or1D(k1, K, oedge[10]);
581 case 18:
return verts[4];
582 case 19:
return edges[4] + Or1D(i1, I, oedge[4]);
583 case 20:
return verts[5];
584 case 21:
return edges[7] + Or1D(j1, J, oedge[7]);
585 case 22:
return faces[5] + Or2D(i1, j1, I, J, oface[5]);
586 case 23:
return edges[5] + Or1D(j1, J, oedge[5]);
587 case 24:
return verts[7];
588 case 25:
return edges[6] + Or1D(i1, I, oedge[6]);
589 case 26:
return verts[6];
592 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)