![]() |
MFEM v4.8.0
Finite element discretization library
|
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh. It also defines and manages DOFs in NURBS finite element spaces. More...
#include <nurbs.hpp>
Public Member Functions | |
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 * > p) | |
NURBSExtension & | operator= (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 KnotVector * | GetKnotVector (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. | |
Table * | GetElementDofTable () |
Table * | GetBdrElementDofTable () |
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. | |
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 Vector & | GetWeights () const |
Access function to the vector of weights weights. | |
Vector & | GetWeights () |
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 | UniformRefinement (Array< int > const &rf) |
void | Coarsen (int cf=2, real_t tol=1.0e-12) |
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) |
NURBSExtension * | GetDivExtension (int component) |
NURBSExtension * | GetCurlExtension (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. | |
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. | |
Protected Types | |
enum class | Mode { H_1 , H_DIV , H_CURL } |
Flag for indicating what type of NURBS fespace this extension is used for. More... | |
Protected Member Functions | |
int | KnotInd (int edge) const |
Return the unsigned index of the KnotVector for edge edge. | |
KnotVector * | KnotVec (int edge) |
const KnotVector * | KnotVec (int edge) const |
const KnotVector * | KnotVec (int edge, int oedge, int *okv) const |
void | CheckPatches () |
Throw an error if any patch has an inconsistent edge-to-knot 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 | GenerateOffsets () |
Set the mesh and space offsets, and also count the global NumOfVertices and the global NumOfDofs. | |
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. | |
NURBSExtension () | |
To be used by ParNURBSExtension constructor(s) | |
Protected Attributes | |
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 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 |
Mesh * | patchTopo |
Patch topology mesh. | |
bool | own_topo |
Whether this object owns patchTopo. | |
Array< int > | edge_to_knot |
Map from edge indices to 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 |
Table * | el_dof |
Table of DOFs for each element (el_dof) or boundary element (bel_dof). | |
Table * | bel_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. | |
Friends | |
class | ParNURBSExtension |
class | NURBSPatchMap |
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh. It also defines and manages DOFs in NURBS finite element spaces.
|
strongprotected |
|
inlineprotected |
To be used by ParNURBSExtension constructor(s)
mfem::NURBSExtension::NURBSExtension | ( | const NURBSExtension & | orig | ) |
mfem::NURBSExtension::NURBSExtension | ( | std::istream & | input, |
bool | spacing = false ) |
Read-in a NURBSExtension from a stream input..
mfem::NURBSExtension::NURBSExtension | ( | NURBSExtension * | parent, |
int | newOrder ) |
Create a NURBSExtension with elevated order by repeating the endpoints of the KnotVectors and using uniform weights of 1.
mfem::NURBSExtension::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.
note If a KnotVector in parent already has order greater than or equal to the corresponding entry in newOrder, it will be used unmodified.
mfem::NURBSExtension::NURBSExtension | ( | Mesh * | mesh_array[], |
int | num_pieces ) |
Construct a NURBSExtension by merging a partitioned NURBS mesh.
mfem::NURBSExtension::NURBSExtension | ( | const Mesh * | patch_topology, |
const Array< const NURBSPatch * > | p ) |
|
virtual |
Destroy a NURBSExtension.
|
protected |
Throw an error if any boundary patch has invalid KnotVector orientation.
|
protected |
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.
|
protected |
void mfem::NURBSExtension::Coarsen | ( | int | cf = 2, |
real_t | tol = 1.0e-12 ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void mfem::NURBSExtension::ConvertToPatches | ( | const Vector & | Nodes | ) |
|
protected |
|
protected |
|
protected |
void mfem::NURBSExtension::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)).
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
|
inline |
void mfem::NURBSExtension::GetBdrPatchKnotVectors | ( | int | bp, |
Array< const KnotVector * > & | kv ) const |
|
protected |
void mfem::NURBSExtension::GetCoarseningFactors | ( | Array< int > & | f | ) | const |
NURBSExtension * mfem::NURBSExtension::GetCurlExtension | ( | int | component | ) |
Returns the NURBSExtension to be used for component of an H(curl) conforming NURBS space. Caller gets ownership of the returned object, and is responsible for deletion.
NURBSExtension * mfem::NURBSExtension::GetDivExtension | ( | int | component | ) |
Returns the NURBSExtension to be used for component of an H(div) conforming NURBS space. Caller gets ownership of the returned object, and is responsible for deletion.
|
inline |
void mfem::NURBSExtension::GetElementIJK | ( | int | elem, |
Array< int > & | ijk ) |
void mfem::NURBSExtension::GetElementLocalToGlobal | ( | Array< int > & | lelem_elem | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
KnotVector read-only access function.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
If all KnotVector orders are identical, return that number. Otherwise, return NURBSFECollection::VariableOrder.
|
inline |
|
inline |
|
inline |
const Array< int > & mfem::NURBSExtension::GetPatchBdrElements | ( | int | patch | ) |
void mfem::NURBSExtension::GetPatchDofs | ( | const int | patch, |
Array< int > & | dofs ) |
const Array< int > & mfem::NURBSExtension::GetPatchElements | ( | int | patch | ) |
void mfem::NURBSExtension::GetPatchKnotVectors | ( | int | p, |
Array< const KnotVector * > & | kv ) const |
|
protected |
|
protected |
|
inline |
void mfem::NURBSExtension::GetVertexLocalToGlobal | ( | Array< int > & | lvert_vert | ) |
|
inline |
|
inline |
|
protected |
|
inlineprotected |
Return the unsigned index of the KnotVector for edge edge.
void mfem::NURBSExtension::KnotInsert | ( | Array< KnotVector * > & | kv | ) |
|
inlineprotected |
Access function for the KnotVector associated with edge edge.
|
inlineprotected |
Const access function for the KnotVector associated with edge edge.
|
inlineprotected |
void mfem::NURBSExtension::LoadBE | ( | int | i, |
const FiniteElement * | BE ) const |
void mfem::NURBSExtension::LoadFE | ( | int | i, |
const FiniteElement * | FE ) const |
void mfem::NURBSExtension::LoadSolution | ( | std::istream & | input, |
GridFunction & | sol ) const |
Read a GridFunction sol from stream input, written patch-by-patch, e.g. with PrintSolution().
void mfem::NURBSExtension::MergeGridFunctions | ( | GridFunction * | gf_array[], |
int | num_pieces, | ||
GridFunction & | merged ) |
|
protected |
|
delete |
Copy assignment not supported.
void mfem::NURBSExtension::Print | ( | std::ostream & | os, |
const std::string & | comments = "" ) const |
Writes all patch data to the stream os.
The optional input argument comments is a string of comments to be printed after the first line (containing version number) of a mesh file. The output is formatted for writing a mesh to file. This function is called by Mesh::Printer.
void mfem::NURBSExtension::PrintCharacteristics | ( | std::ostream & | os | ) | const |
void mfem::NURBSExtension::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.
void mfem::NURBSExtension::PrintSolution | ( | const GridFunction & | sol, |
std::ostream & | os ) const |
Write a GridFunction sol patch-by-patch to stream os.
|
protected |
|
protected |
|
protected |
void mfem::NURBSExtension::SetCoordsFromPatches | ( | Vector & | Nodes | ) |
void mfem::NURBSExtension::SetKnotsFromPatches | ( | ) |
|
protected |
Set overall order mOrder based on KnotVector orders.
|
protected |
Set orders from KnotVector orders.
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
void mfem::NURBSExtension::UniformRefinement | ( | Array< int > const & | rf | ) |
void mfem::NURBSExtension::UniformRefinement | ( | int | rf = 2 | ) |
|
protected |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
Map from edge indices to KnotVector indices.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Order of KnotVectors, see GetOrder() for description.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |