MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::NCNURBSExtension Class Reference

NCNURBSExtension extends NURBSExtension to support NC-patch NURBS meshes. More...

#include <ncnurbs.hpp>

Inheritance diagram for mfem::NCNURBSExtension:
[legend]
Collaboration diagram for mfem::NCNURBSExtension:
[legend]

Public Member Functions

 NCNURBSExtension (const NCNURBSExtension &orig)
 Copy constructor: deep copy.
 
 NCNURBSExtension (std::istream &input, bool spacing=false)
 
void UniformRefinement (const Array< int > &rf) override
 
- Public Member Functions inherited from mfem::NURBSExtension
 NURBSExtension (const NURBSExtension &orig)
 Copy constructor: deep copy.
 
 NURBSExtension (std::istream &input, bool spacing=false)
 Read-in a NURBSExtension from a stream input.
 
 NURBSExtension (NURBSExtension *parent, int newOrder)
 Create a NURBSExtension with elevated order by repeating the endpoints of the KnotVectors and using uniform weights of 1.
 
 NURBSExtension (NURBSExtension *parent, const Array< int > &newOrders, Mode mode=Mode::H_1)
 Create a NURBSExtension with elevated KnotVector orders (by repeating the endpoints of the KnotVectors and using uniform weights of 1) as given by the array newOrders.
 
 NURBSExtension (Mesh *mesh_array[], int num_pieces)
 Construct a NURBSExtension by merging a partitioned NURBS mesh.
 
 NURBSExtension (const Mesh *patch_topology, const Array< const NURBSPatch * > &patches_)
 
NURBSExtensionoperator= (const NURBSExtension &)=delete
 Copy assignment not supported.
 
void ConnectBoundaries (Array< int > &master, Array< int > &slave)
 Generate connections between boundaries, such as periodic BCs.
 
const Array< int > & GetMaster () const
 
Array< int > & GetMaster ()
 
const Array< int > & GetSlave () const
 
Array< int > & GetSlave ()
 
void MergeGridFunctions (GridFunction *gf_array[], int num_pieces, GridFunction &merged)
 Set the DOFs of merged to values from active elements in num_pieces of Gridfunctions gf_array.
 
virtual ~NURBSExtension ()
 Destroy a NURBSExtension.
 
void Print (std::ostream &os, const std::string &comments="") const
 Writes all patch data to the stream os.
 
void PrintCharacteristics (std::ostream &os) const
 Print various mesh characteristics to the stream os.
 
void PrintFunctions (const char *basename, int samples=11) const
 Call KnotVector::PrintFunctions for all KnotVectors, using a separate, newly created ofstream with filename "basename_i.dat" for KnotVector i.
 
int Dimension () const
 Return the dimension of the reference space (not physical space).
 
int GetNP () const
 Return the number of patches.
 
int GetNBP () const
 Return the number of boundary patches.
 
const Array< int > & GetOrders () const
 Read-only access to the orders of all KnotVectors.
 
int GetOrder () const
 If all KnotVector orders are identical, return that number. Otherwise, return NURBSFECollection::VariableOrder.
 
int GetNKV () const
 Return the number of KnotVectors.
 
int GetGNV () const
 Return the global number of vertices.
 
int GetNV () const
 Return the local number of active vertices.
 
int GetGNE () const
 Return the global number of elements.
 
int GetNE () const
 Return the number of active elements.
 
int GetGNBE () const
 Return the global number of boundary elements.
 
int GetNBE () const
 Return the number of active boundary elements.
 
int GetNTotalDof () const
 Return the total number of DOFs.
 
int GetNDof () const
 Return the number of active DOFs.
 
int GetActiveDof (int glob) const
 Return the local DOF number for a given global DOF number glob.
 
int DofMap (int dof) const
 Return the dof index whilst accounting for periodic boundaries.
 
void GetPatchKnotVectors (int p, Array< const KnotVector * > &kv) const
 Return KnotVectors in kv in each dimension for patch p.
 
void GetBdrPatchKnotVectors (int bp, Array< const KnotVector * > &kv) const
 Return KnotVectors in kv in each dimension for boundary patch bp.
 
const KnotVectorGetKnotVector (int i) const
 KnotVector read-only access function.
 
void GetElementTopo (Array< Element * > &elements) const
 Generate the active mesh elements and return them in elements.
 
void GetBdrElementTopo (Array< Element * > &boundary) const
 Generate the active mesh boundary elements and return them in boundary.
 
bool HavePatches () const
 Return true if at least 1 patch is defined, false otherwise.
 
TableGetElementDofTable ()
 
TableGetBdrElementDofTable ()
 
void GetVertexLocalToGlobal (Array< int > &lvert_vert)
 Get the local to global vertex index map lvert_vert.
 
void GetElementLocalToGlobal (Array< int > &lelem_elem)
 Get the local to global element index map lelem_elem.
 
void SetPatchAttribute (int i, int attr)
 Set the attribute for patch i, which is set to all elements in the patch.
 
int GetPatchAttribute (int i) const
 Get the attribute for patch i, which is set to all elements in the patch.
 
void SetPatchBdrAttribute (int i, int attr)
 Set the attribute for patch boundary element i to attr, which is set to all boundary elements in the patch.
 
int GetPatchBdrAttribute (int i) const
 Get the attribute for boundary patch element i, which is set to all boundary elements in the patch.
 
int KnotVecNE (int edge) const
 Return the number of knotvector elements for edge edge.
 
void LoadFE (int i, const FiniteElement *FE) const
 Load element i into FE.
 
void LoadBE (int i, const FiniteElement *BE) const
 Load boundary element i into BE.
 
const VectorGetWeights () const
 Access function to the vector of weights weights.
 
VectorGetWeights ()
 
void ConvertToPatches (const Vector &Nodes)
 Define patches in IKJ (B-net) format, using FE coordinates in Nodes.
 
void SetKnotsFromPatches ()
 Set KnotVectors from patches and construct mesh and space data.
 
void SetCoordsFromPatches (Vector &Nodes)
 Set FE coordinates in Nodes, using data from patches, and erase patches.
 
void LoadSolution (std::istream &input, GridFunction &sol) const
 Read a GridFunction sol from stream input, written patch-by-patch, e.g. with PrintSolution().
 
void PrintSolution (const GridFunction &sol, std::ostream &os) const
 Write a GridFunction sol patch-by-patch to stream os.
 
void DegreeElevate (int rel_degree, int degree=16)
 Call DegreeElevate for all KnotVectors of all patches. For each KnotVector, the new degree is max(old_degree, min(old_degree + rel_degree, degree)).
 
void UniformRefinement (int rf=2)
 Refine with optional refinement factor rf. Uniform means refinement is done everywhere by the same factor, although nonuniform spacing functions may be used.
 
void Coarsen (int cf=2, real_t tol=1.0e-12)
 Coarsen with optional coarsening factor cf.
 
void Coarsen (Array< int > const &cf, real_t tol=1.0e-12)
 
void KnotInsert (Array< KnotVector * > &kv)
 Insert knots from kv into all KnotVectors in all patches. The size of kv should be the same as knotVectors.
 
void KnotInsert (Array< Vector * > &kv)
 
NURBSExtensionGetDivExtension (int component)
 
NURBSExtensionGetCurlExtension (int component)
 
void KnotRemove (Array< Vector * > &kv, real_t tol=1.0e-12)
 
void GetCoarseningFactors (Array< int > &f) const
 
int GetElementPatch (int elem) const
 Returns the index of the patch containing element elem.
 
void GetElementIJK (int elem, Array< int > &ijk)
 Return Cartesian indices (i,j) in 2D or (i,j,k) in 3D of element elem, in the knot-span tensor product ordering for its patch.
 
void GetPatchDofs (const int patch, Array< int > &dofs)
 Return the degrees of freedom in dofs on patch patch, in Cartesian order.
 
Mesh GetPatchTopology () const
 Returns a deep copy of the patch topology mesh.
 
void GetPatches (Array< NURBSPatch * > &patches)
 
const Array< int > & GetPatchElements (int patch)
 Return the array of indices of all elements in patch patch.
 
const Array< int > & GetPatchBdrElements (int patch)
 Return the array of indices of all boundary elements in patch patch.
 
bool NonconformingPatches () const
 Return true if the patch topology mesh is nonconforming.
 
NCMeshGetNCMesh () const
 Return a pointer to the NCMesh of a nonconforming patch topology mesh.
 
void FullyCoarsen ()
 Fully coarsen all structured patches, for non-nested refinement of a mesh with a nonconforming patch topology.
 

Protected Member Functions

void GenerateOffsets () override
 Set the mesh and space offsets, and also count the global NumOfVertices and the global NumOfDofs.
 
bool IsMasterEdge (int edge) const override
 Return true if edge is a master NC-patch edge.
 
bool IsMasterFace (int face) const override
 Return true if face is a master NC-patch face.
 
int VertexPairToEdge (const std::pair< int, int > &vertices) const override
 Given a pair of vertices, return the corresponding edge.
 
void GetMasterEdgeDofs (bool dof, int me, Array< int > &dofs) const override
 Get the DOFs (dof = true) or vertices (dof = false) for master edge me.
 
void GetMasterFaceDofs (bool dof, int mf, Array2D< int > &dofs) const override
 Get the DOFs (dof = true) or vertices (dof = false) for master face mf.
 
void LoadFactorsForKV (const std::string &filename)
 Load refinement factors for a list of knotvectors from file.
 
int SetPatchFactors (int p)
 Set consistent refinement factors on patch p.
 
void PropagateFactorsForKV (int rf_default)
 Ensure consistent refinement factors on all knotvectors.
 
void RefineWithKVFactors (int rf, const std::string &kvf_filename, bool coarsened) override
 
- Protected Member Functions inherited from mfem::NURBSExtension
int KnotInd (int edge) const
 Return the unsigned index of the KnotVector for edge edge.
 
int KnotSign (int edge) const
 Return the sign (orientation) of the KnotVector for edge edge.
 
KnotVectorKnotVec (int edge)
 DOF to owning patch map in SetSolutionVector()
 
const KnotVectorKnotVec (int edge) const
 
const KnotVectorKnotVec (int edge, int oedge, int *okv) const
 Const access function for the KnotVector associated with edge edge. The output orientation okv is set to oedge with sign flipped if the KnotVector index associated with edge edge is negative.
 
void CheckPatches ()
 Throw an error if any patch has an inconsistent edge_to_ukv mapping.
 
void CheckBdrPatches ()
 Throw an error if any boundary patch has invalid KnotVector orientation.
 
void CheckKVDirection (int p, Array< int > &kvdir)
 Return the directions in kvdir of the KnotVectors in patch p based on the patch edge orientations. Each entry of kvdir is -1 if the KnotVector direction is flipped, +1 otherwise.
 
void CreateComprehensiveKV ()
 Create the comprehensive set of KnotVectors. In 1D, this set is identical to the unique set of KnotVectors.
 
void UpdateUniqueKV ()
 
bool ConsistentKVSets ()
 Check if the comprehensive array of KnotVectors agrees with the unique set of KnotVectors, on each patch. Return false if there is a difference, true otherwise. This function throws an error in 1D.
 
void GetPatchKnotVectors (int p, Array< KnotVector * > &kv)
 Return KnotVectors in kv in each dimension for patch p.
 
void GetBdrPatchKnotVectors (int bp, Array< KnotVector * > &kv)
 Return KnotVectors in kv in each dimension for boundary patch bp.
 
void SetOrderFromOrders ()
 Set overall order mOrder based on KnotVector orders.
 
void SetOrdersFromKnotVectors ()
 Set orders from KnotVector orders.
 
void InitDofMap ()
 Set DOF map sizes to 0.
 
void ConnectBoundaries ()
 Set DOF maps for periodic BC.
 
void ConnectBoundaries1D (int bnd0, int bnd1)
 
void ConnectBoundaries2D (int bnd0, int bnd1)
 
void ConnectBoundaries3D (int bnd0, int bnd1)
 
void CountElements ()
 Count the global NumOfElements.
 
void CountBdrElements ()
 Count the global NumOfBdrElements.
 
void Get1DElementTopo (Array< Element * > &elements) const
 Generate the active mesh elements and return them in elements.
 
void Get2DElementTopo (Array< Element * > &elements) const
 
void Get3DElementTopo (Array< Element * > &elements) const
 
void Get1DBdrElementTopo (Array< Element * > &boundary) const
 Generate the active mesh boundary elements and return them in boundary.
 
void Get2DBdrElementTopo (Array< Element * > &boundary) const
 
void Get3DBdrElementTopo (Array< Element * > &boundary) const
 
void GenerateElementDofTable ()
 Based on activeElem, count NumOfActiveDofs and generate el_dof, el_to_patch, el_to_IJK, activeDof map (global-to-local).
 
void Generate1DElementDofTable ()
 Generate elem_to_global-dof table for the active elements, and define el_to_patch, el_to_IJK, activeDof (as bool).
 
void Generate2DElementDofTable ()
 
void Generate3DElementDofTable ()
 
void GenerateBdrElementDofTable ()
 Call after GenerateElementDofTable to set boundary element DOF table.
 
void Generate1DBdrElementDofTable ()
 Generate the table of global DOFs for active boundary elements, and define bel_to_patch, bel_to_IJK.
 
void Generate2DBdrElementDofTable ()
 
void Generate3DBdrElementDofTable ()
 
void GetPatchNets (const Vector &coords, int vdim)
 Set the B-NET on each patch using values from coords.
 
void Get1DPatchNets (const Vector &coords, int vdim)
 
void Get2DPatchNets (const Vector &coords, int vdim)
 
void Get3DPatchNets (const Vector &coords, int vdim)
 
void SetSolutionVector (Vector &coords, int vdim)
 Return in coords the coordinates from each patch. Side effects: delete the patches and update the weights from the patches.
 
void Set1DSolutionVector (Vector &coords, int vdim)
 
void Set2DSolutionVector (Vector &coords, int vdim)
 
void Set3DSolutionVector (Vector &coords, int vdim)
 
void GenerateActiveVertices ()
 Determine activeVert, NumOfActiveVertices from the activeElem array.
 
void GenerateActiveBdrElems ()
 Determine activeBdrElem, NumOfActiveBdrElems.
 
void MergeWeights (Mesh *mesh_array[], int num_pieces)
 Set the weights in this object to values from active elements in num_pieces meshes in mesh_array.
 
void SetPatchToElements ()
 Set patch_to_el.
 
void SetPatchToBdrElements ()
 Set patch_to_bel.
 
void Load (std::istream &input, bool spacing)
 Load data from file (used by constructor).
 
void GetPatchOffsets (int &meshCounter, int &spaceCounter)
 Helper function for GenerateOffsets().
 
const NURBSPatchGetPatch (int patch) const
 Return NURBSPatch object; returned object should NOT be deleted.
 
 NURBSExtension ()
 To be used by ParNURBSExtension constructor(s)
 

Additional Inherited Members

- Protected Types inherited from mfem::NURBSExtension
enum class  Mode { H_1 , H_DIV , H_CURL }
 Flag for indicating what type of NURBS fespace this extension is used for. More...
 
- Protected Attributes inherited from mfem::NURBSExtension
Mode mode = Mode::H_1
 
int mOrder
 Order of KnotVectors, see GetOrder() for description.
 
Array< int > mOrders
 Orders of all KnotVectors.
 
int NumOfKnotVectors
 Number of unique (not comprehensive) KnotVectors.
 
int NumOfVertices
 Global entity counts.
 
int NumOfElements
 
int NumOfBdrElements
 
int NumOfDofs
 
int NumOfActiveVertices
 Local entity counts.
 
int NumOfActiveElems
 
int NumOfActiveBdrElems
 
int NumOfActiveDofs
 
Array< int > activeVert
 
Array< bool > activeElem
 
Array< bool > activeBdrElem
 
Array< int > activeDof
 
MeshpatchTopo
 Patch topology mesh.
 
bool own_topo
 Whether this object owns patchTopo.
 
Array< int > edge_to_ukv
 Map from patchTopo edge indices to unique KnotVector indices.
 
Array< KnotVector * > knotVectors
 Set of unique KnotVectors.
 
Array< KnotVector * > knotVectorsCompr
 Comprehensive set of all KnotVectors, one for every edge.
 
Vector weights
 Weights for each control point or DOF.
 
Array< int > d_to_d
 Periodic BC info:
 
Array< int > master
 
Array< int > slave
 
Array< int > v_meshOffsets
 Global mesh offsets, meshOffsets == meshVertexOffsets.
 
Array< int > e_meshOffsets
 
Array< int > f_meshOffsets
 
Array< int > p_meshOffsets
 
Array< int > v_spaceOffsets
 Global space offsets, spaceOffsets == dofOffsets.
 
Array< int > e_spaceOffsets
 
Array< int > f_spaceOffsets
 
Array< int > p_spaceOffsets
 
Tableel_dof
 Table of DOFs for each element (el_dof) or boundary element (bel_dof).
 
Tablebel_dof
 
Array< int > el_to_patch
 Map from element indices to patch indices.
 
Array< int > bel_to_patch
 Map from boundary element indices to patch indices.
 
Array2D< int > el_to_IJK
 Map from element indices to IJK knot span indices.
 
Array2D< int > bel_to_IJK
 
std::vector< Array< int > > patch_to_el
 For each patch p, patch_to_el[p] lists all elements in the patch.
 
std::vector< Array< int > > patch_to_bel
 For each patch p, patch_to_bel[p] lists all boundary elements in the patch.
 
Array< NURBSPatch * > patches
 Array of all patches in the mesh.
 
bool nonconformingPT = false
 
int num_structured_patches = 0
 Whether patchTopo is a nonconforming mesh.
 
Array3D< double > patchCP
 Number of structured patches.
 
std::vector< Array< int > > kvf
 Control points for coarse structured patches.
 
std::vector< Array< int > > kvf_coarse
 
Array< int > ref_factors
 Knotvector refinement factors.
 
Array< int > dof2patch
 Unset refinement factor value.
 
- Static Protected Attributes inherited from mfem::NURBSExtension
static constexpr int unsetFactor = 0
 Refinement factors in each dimension.
 

Detailed Description

NCNURBSExtension extends NURBSExtension to support NC-patch NURBS meshes.

Definition at line 22 of file ncnurbs.hpp.

Constructor & Destructor Documentation

◆ NCNURBSExtension() [1/2]

mfem::NCNURBSExtension::NCNURBSExtension ( const NCNURBSExtension & orig)

Copy constructor: deep copy.

Definition at line 44 of file ncnurbs.cpp.

◆ NCNURBSExtension() [2/2]

mfem::NCNURBSExtension::NCNURBSExtension ( std::istream & input,
bool spacing = false )

Definition at line 34 of file ncnurbs.cpp.

Member Function Documentation

◆ GenerateOffsets()

void mfem::NCNURBSExtension::GenerateOffsets ( )
overrideprotectedvirtual

Set the mesh and space offsets, and also count the global NumOfVertices and the global NumOfDofs.

Reimplemented from mfem::NURBSExtension.

Definition at line 3475 of file ncnurbs.cpp.

◆ GetMasterEdgeDofs()

void mfem::NCNURBSExtension::GetMasterEdgeDofs ( bool dof,
int me,
Array< int > & dofs ) const
overrideprotectedvirtual

Get the DOFs (dof = true) or vertices (dof = false) for master edge me.

Reimplemented from mfem::NURBSExtension.

Definition at line 660 of file ncnurbs.cpp.

◆ GetMasterFaceDofs()

void mfem::NCNURBSExtension::GetMasterFaceDofs ( bool dof,
int mf,
Array2D< int > & dofs ) const
overrideprotectedvirtual

Get the DOFs (dof = true) or vertices (dof = false) for master face mf.

Reimplemented from mfem::NURBSExtension.

Definition at line 925 of file ncnurbs.cpp.

◆ IsMasterEdge()

bool mfem::NCNURBSExtension::IsMasterEdge ( int edge) const
inlineoverrideprotectedvirtual

Return true if edge is a master NC-patch edge.

Reimplemented from mfem::NURBSExtension.

Definition at line 38 of file ncnurbs.hpp.

◆ IsMasterFace()

bool mfem::NCNURBSExtension::IsMasterFace ( int face) const
inlineoverrideprotectedvirtual

Return true if face is a master NC-patch face.

Reimplemented from mfem::NURBSExtension.

Definition at line 42 of file ncnurbs.hpp.

◆ LoadFactorsForKV()

void mfem::NCNURBSExtension::LoadFactorsForKV ( const std::string & filename)
protected

Load refinement factors for a list of knotvectors from file.

Definition at line 2348 of file ncnurbs.cpp.

◆ PropagateFactorsForKV()

void mfem::NCNURBSExtension::PropagateFactorsForKV ( int rf_default)
protected

Ensure consistent refinement factors on all knotvectors.

Definition at line 2617 of file ncnurbs.cpp.

◆ RefineWithKVFactors()

void mfem::NCNURBSExtension::RefineWithKVFactors ( int rf,
const std::string & kvf_filename,
bool coarsened )
overrideprotectedvirtual

Refine with refinement factors loaded for some knotvectors specified in the given file, with default refinement factor rf elsewhere. The flag coarsened indicates whether each patch is a single element.

Reimplemented from mfem::NURBSExtension.

Definition at line 2900 of file ncnurbs.cpp.

◆ SetPatchFactors()

int mfem::NCNURBSExtension::SetPatchFactors ( int p)
protected

Set consistent refinement factors on patch p.

Definition at line 2486 of file ncnurbs.cpp.

◆ UniformRefinement()

void mfem::NCNURBSExtension::UniformRefinement ( const Array< int > & rf)
overridevirtual

Reimplemented from mfem::NURBSExtension.

Definition at line 3338 of file ncnurbs.cpp.

◆ VertexPairToEdge()

int mfem::NCNURBSExtension::VertexPairToEdge ( const std::pair< int, int > & vertices) const
inlineoverrideprotectedvirtual

Given a pair of vertices, return the corresponding edge.

Reimplemented from mfem::NURBSExtension.

Definition at line 46 of file ncnurbs.hpp.


The documentation for this class was generated from the following files: