MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::NURBSPatch Class Reference

A NURBS patch can be 1D, 2D, or 3D, and is defined as a tensor product of KnotVectors. More...

#include <nurbs.hpp>

Collaboration diagram for mfem::NURBSPatch:
[legend]

Public Member Functions

 NURBSPatch (const NURBSPatch &orig)
 Copy constructor.
 
 NURBSPatch (std::istream &input)
 Constructor using data read from stream input.
 
 NURBSPatch (const KnotVector *kv0, const KnotVector *kv1, int dim)
 Constructor for a 2D patch. dim is the physical dimension plus 1.
 
 NURBSPatch (const KnotVector *kv0, const KnotVector *kv1, const KnotVector *kv2, int dim)
 Constructor for a 3D patch.
 
 NURBSPatch (const KnotVector *kv0, const KnotVector *kv1, int dim_, const real_t *control_points)
 
 NURBSPatch (const KnotVector *kv0, const KnotVector *kv1, const KnotVector *kv2, int dim_, const real_t *control_points)
 
 NURBSPatch (Array< const KnotVector * > &kv_, int dim_, const real_t *control_points)
 
 NURBSPatch (Array< const KnotVector * > &kv, int dim)
 Constructor for a patch of dimension equal to the size of kv.
 
NURBSPatchoperator= (const NURBSPatch &)=delete
 Copy assignment not supported.
 
 ~NURBSPatch ()
 Deletes data and KnotVectors.
 
void Print (std::ostream &os) const
 Writes KnotVectors and data to the stream os.
 
void DegreeElevate (int dir, int t)
 Increase the order in direction dir by t >= 0.
 
void KnotInsert (int dir, const KnotVector &knot)
 Insert any new knots from knot in direction dir. If the order of knot is higher than the current order in direction dir, then the order is elevated in that direction to match.
 
void KnotInsert (int dir, const Vector &knot)
 Insert knots from knot in direction dir. If a knot already exists, then it is still added, increasing its multiplicity.
 
void KnotInsert (Array< Vector * > &knot)
 Call KnotInsert for each direction with the corresponding knot entry.
 
void KnotInsert (Array< KnotVector * > &knot)
 Insert knots from knot determined by Difference, in each direction.
 
int KnotRemove (int dir, real_t knot, int ntimes=1, real_t tol=1.0e-12)
 Remove knot with value knot from direction dir.
 
void KnotRemove (int dir, Vector const &knot, real_t tol=1.0e-12)
 Remove all knots in knot once.
 
void KnotRemove (Array< Vector * > &knot, real_t tol=1.0e-12)
 Remove all knots in knot once, for each direction.
 
void DegreeElevate (int t)
 
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)
 Coarsen with optional coarsening factor cf which divides the number of elements in each dimension. Nonuniform spacing functions may be used in each direction.
 
void Coarsen (Array< int > const &cf, real_t tol=1.0e-12)
 
void GetCoarseningFactors (Array< int > &f) const
 Calls KnotVector::GetCoarseningFactor for each direction.
 
void SetKnotVectorsCoarse (bool c)
 Marks the KnotVector in each dimension as coarse.
 
int GetNC () const
 Return the number of components stored in the NURBSPatch.
 
int GetNKV () const
 Return the number of KnotVectors, which is the patch dimension.
 
KnotVectorGetKV (int dir)
 
real_toperator() (int i, int l)
 1D access function. i is a B-NET index, and l is a variable index.
 
const real_toperator() (int i, int l) const
 
real_toperator() (int i, int j, int l)
 2D access function. i, j are B-NET indices, and l is a variable index.
 
const real_toperator() (int i, int j, int l) const
 
real_toperator() (int i, int j, int k, int l)
 3D access function. i, j, k are B-NET indices, and l is a variable index.
 
const real_toperator() (int i, int j, int k, int l) const
 
void FlipDirection (int dir)
 Reverse data and knots in direction dir.
 
void SwapDirections (int dir1, int dir2)
 Swap data and KnotVectors in directions dir1 and dir2.
 
void Rotate (real_t angle, real_t normal[]=NULL)
 Rotate the NURBSPatch in 2D or 3D..
 
void Rotate2D (real_t angle)
 Rotate the NURBSPatch, 2D case.
 
void Rotate3D (real_t normal[], real_t angle)
 Rotate the NURBSPatch, 3D case.
 
int MakeUniformDegree (int degree=-1)
 

Static Public Member Functions

static void Get2DRotationMatrix (real_t angle, DenseMatrix &T)
 Compute the 2D rotation matrix T for angle angle.
 
static void Get3DRotationMatrix (real_t n[], real_t angle, real_t r, DenseMatrix &T)
 Compute the 3D rotation matrix T for angle angle around axis n (a 3D vector, not necessarily normalized) and scalar factor r.
 

Protected Member Functions

int SetLoopDirection (int dir)
 Flattens the B-NET in direction dir, producing a 1D net. Returns the number of variables per knot in flattened structure.
 
real_tslice (int i, int j)
 Access function for the effectively 1D flattened net, where i is a knot index, and j is an index of a variable per knot.
 
const real_tslice (int i, int j) const
 
 NURBSPatch (NURBSPatch *parent, int dir, int Order, int NCP)
 Copy constructor.
 
void swap (NURBSPatch *np)
 Deletes own data, takes data from np, and deletes np.
 
void init (int dim)
 

Protected Attributes

int ni
 B-NET dimensions.
 
int nj
 
int nk
 
int Dim
 Physical dimension plus 1.
 
real_tdata
 Data with the layout (Dim x ni x nj x nk)
 
Array< KnotVector * > kv
 KnotVectors in each direction.
 
int nd
 
int ls
 
int sd
 

Friends

NURBSPatchInterpolate (NURBSPatch &p1, NURBSPatch &p2)
 Given two patches p1 and p2 of the same dimensions, create and return a new patch by merging their knots and data.
 
NURBSPatchRevolve3D (NURBSPatch &patch, real_t n[], real_t ang, int times)
 

Detailed Description

A NURBS patch can be 1D, 2D, or 3D, and is defined as a tensor product of KnotVectors.

Definition at line 211 of file nurbs.hpp.

Constructor & Destructor Documentation

◆ NURBSPatch() [1/9]

mfem::NURBSPatch::NURBSPatch ( NURBSPatch * parent,
int dir,
int Order,
int NCP )
protected

Copy constructor.

Definition at line 829 of file nurbs.cpp.

◆ NURBSPatch() [2/9]

mfem::NURBSPatch::NURBSPatch ( const NURBSPatch & orig)

Copy constructor.

Definition at line 743 of file nurbs.cpp.

◆ NURBSPatch() [3/9]

mfem::NURBSPatch::NURBSPatch ( std::istream & input)

Constructor using data read from stream input.

Definition at line 759 of file nurbs.cpp.

◆ NURBSPatch() [4/9]

mfem::NURBSPatch::NURBSPatch ( const KnotVector * kv0,
const KnotVector * kv1,
int dim )

Constructor for a 2D patch. dim is the physical dimension plus 1.

Definition at line 801 of file nurbs.cpp.

◆ NURBSPatch() [5/9]

mfem::NURBSPatch::NURBSPatch ( const KnotVector * kv0,
const KnotVector * kv1,
const KnotVector * kv2,
int dim )

Constructor for a 3D patch.

Definition at line 809 of file nurbs.cpp.

◆ NURBSPatch() [6/9]

mfem::NURBSPatch::NURBSPatch ( const KnotVector * kv0,
const KnotVector * kv1,
int dim_,
const real_t * control_points )

Create a bivariate NURBS patch with given control points. See n-variate overload for additional notes.

Definition at line 4917 of file nurbs.cpp.

◆ NURBSPatch() [7/9]

mfem::NURBSPatch::NURBSPatch ( const KnotVector * kv0,
const KnotVector * kv1,
const KnotVector * kv2,
int dim_,
const real_t * control_points )

Create a trivariate NURBS patch with given control points. See n-variate overload for additional notes.

Definition at line 4927 of file nurbs.cpp.

◆ NURBSPatch() [8/9]

mfem::NURBSPatch::NURBSPatch ( Array< const KnotVector * > & kv_,
int dim_,
const real_t * control_points )

Create an n-variate NURBS patch with given control points of dimension dim_, where n is the length of the array of knot vectors and dim_ includes the weight. The array of control point coordinates stores each point's coordinates contiguously, and points are ordered in a standard ijk grid ordering.

Definition at line 4939 of file nurbs.cpp.

◆ NURBSPatch() [9/9]

mfem::NURBSPatch::NURBSPatch ( Array< const KnotVector * > & kv,
int dim )

Constructor for a patch of dimension equal to the size of kv.

Definition at line 819 of file nurbs.cpp.

◆ ~NURBSPatch()

mfem::NURBSPatch::~NURBSPatch ( )

Deletes data and KnotVectors.

Definition at line 870 of file nurbs.cpp.

Member Function Documentation

◆ Coarsen() [1/2]

void mfem::NURBSPatch::Coarsen ( Array< int > const & cf,
real_t tol = 1.0e-12 )

Definition at line 1002 of file nurbs.cpp.

◆ Coarsen() [2/2]

void mfem::NURBSPatch::Coarsen ( int cf = 2,
real_t tol = 1.0e-12 )

Coarsen with optional coarsening factor cf which divides the number of elements in each dimension. Nonuniform spacing functions may be used in each direction.

Parameters
[in]cfOptional coarsening factor. If scalar, the factor is used for all dimensions. If an array, factors can be specified for each dimension.
[in]tolNURBS geometry deviation tolerance, cf. Algorithm A5.8 of "The NURBS Book", 2nd ed, Piegl and Tiller.

Definition at line 1024 of file nurbs.cpp.

◆ DegreeElevate() [1/2]

void mfem::NURBSPatch::DegreeElevate ( int dir,
int t )

Increase the order in direction dir by t >= 0.

Definition at line 1417 of file nurbs.cpp.

◆ DegreeElevate() [2/2]

void mfem::NURBSPatch::DegreeElevate ( int t)

Definition at line 1408 of file nurbs.cpp.

◆ FlipDirection()

void mfem::NURBSPatch::FlipDirection ( int dir)

Reverse data and knots in direction dir.

Definition at line 1673 of file nurbs.cpp.

◆ Get2DRotationMatrix()

void mfem::NURBSPatch::Get2DRotationMatrix ( real_t angle,
DenseMatrix & T )
static

Compute the 2D rotation matrix T for angle angle.

Definition at line 1727 of file nurbs.cpp.

◆ Get3DRotationMatrix()

void mfem::NURBSPatch::Get3DRotationMatrix ( real_t n[],
real_t angle,
real_t r,
DenseMatrix & T )
static

Compute the 3D rotation matrix T for angle angle around axis n (a 3D vector, not necessarily normalized) and scalar factor r.

Definition at line 1765 of file nurbs.cpp.

◆ GetCoarseningFactors()

void mfem::NURBSPatch::GetCoarseningFactors ( Array< int > & f) const

Calls KnotVector::GetCoarseningFactor for each direction.

Definition at line 1031 of file nurbs.cpp.

◆ GetKV()

KnotVector * mfem::NURBSPatch::GetKV ( int dir)
inline

Return a pointer to the KnotVector in direction dir.

Note
The returned object should NOT be deleted by the caller.

Definition at line 377 of file nurbs.hpp.

◆ GetNC()

int mfem::NURBSPatch::GetNC ( ) const
inline

Return the number of components stored in the NURBSPatch.

Definition at line 370 of file nurbs.hpp.

◆ GetNKV()

int mfem::NURBSPatch::GetNKV ( ) const
inline

Return the number of KnotVectors, which is the patch dimension.

Definition at line 373 of file nurbs.hpp.

◆ init()

void mfem::NURBSPatch::init ( int dim)
protected

Sets dimensions and allocates data, based on KnotVectors. dim is the physical dimension plus 1.

Definition at line 681 of file nurbs.cpp.

◆ KnotInsert() [1/4]

void mfem::NURBSPatch::KnotInsert ( Array< KnotVector * > & knot)

Insert knots from knot determined by Difference, in each direction.

Definition at line 1040 of file nurbs.cpp.

◆ KnotInsert() [2/4]

void mfem::NURBSPatch::KnotInsert ( Array< Vector * > & knot)

Call KnotInsert for each direction with the corresponding knot entry.

Definition at line 1075 of file nurbs.cpp.

◆ KnotInsert() [3/4]

void mfem::NURBSPatch::KnotInsert ( int dir,
const KnotVector & knot )

Insert any new knots from knot in direction dir. If the order of knot is higher than the current order in direction dir, then the order is elevated in that direction to match.

Definition at line 1049 of file nurbs.cpp.

◆ KnotInsert() [4/4]

void mfem::NURBSPatch::KnotInsert ( int dir,
const Vector & knot )

Insert knots from knot in direction dir. If a knot already exists, then it is still added, increasing its multiplicity.

Definition at line 1102 of file nurbs.cpp.

◆ KnotRemove() [1/3]

void mfem::NURBSPatch::KnotRemove ( Array< Vector * > & knot,
real_t tol = 1.0e-12 )

Remove all knots in knot once, for each direction.

Definition at line 1084 of file nurbs.cpp.

◆ KnotRemove() [2/3]

int mfem::NURBSPatch::KnotRemove ( int dir,
real_t knot,
int ntimes = 1,
real_t tol = 1.0e-12 )

Remove knot with value knot from direction dir.

The optional input parameter ntimes specifies the number of times the knot should be removed, default 1. The knot is removed only if the new curve (in direction dir) deviates from the old curve by less than tol.

Returns
The number of times the knot was successfully removed.

Definition at line 1210 of file nurbs.cpp.

◆ KnotRemove() [3/3]

void mfem::NURBSPatch::KnotRemove ( int dir,
Vector const & knot,
real_t tol = 1.0e-12 )

Remove all knots in knot once.

Definition at line 1092 of file nurbs.cpp.

◆ MakeUniformDegree()

int mfem::NURBSPatch::MakeUniformDegree ( int degree = -1)

Elevate KnotVectors in all directions to degree degree if given, otherwise to the maximum current degree among all directions.

Definition at line 1832 of file nurbs.cpp.

◆ operator()() [1/6]

real_t & mfem::NURBSPatch::operator() ( int i,
int j,
int k,
int l )
inline

3D access function. i, j, k are B-NET indices, and l is a variable index.

Definition at line 1113 of file nurbs.hpp.

◆ operator()() [2/6]

const real_t & mfem::NURBSPatch::operator() ( int i,
int j,
int k,
int l ) const
inline

Definition at line 1126 of file nurbs.hpp.

◆ operator()() [3/6]

real_t & mfem::NURBSPatch::operator() ( int i,
int j,
int l )
inline

2D access function. i, j are B-NET indices, and l is a variable index.

Definition at line 1087 of file nurbs.hpp.

◆ operator()() [4/6]

const real_t & mfem::NURBSPatch::operator() ( int i,
int j,
int l ) const
inline

Definition at line 1100 of file nurbs.hpp.

◆ operator()() [5/6]

real_t & mfem::NURBSPatch::operator() ( int i,
int l )
inline

1D access function. i is a B-NET index, and l is a variable index.

Definition at line 1061 of file nurbs.hpp.

◆ operator()() [6/6]

const real_t & mfem::NURBSPatch::operator() ( int i,
int l ) const
inline

Definition at line 1074 of file nurbs.hpp.

◆ operator=()

NURBSPatch & mfem::NURBSPatch::operator= ( const NURBSPatch & )
delete

Copy assignment not supported.

◆ Print()

void mfem::NURBSPatch::Print ( std::ostream & os) const

Writes KnotVectors and data to the stream os.

The output is formatted for writing a mesh to file. This function is called by NURBSExtension::Print.

Definition at line 883 of file nurbs.cpp.

◆ Rotate()

void mfem::NURBSPatch::Rotate ( real_t angle,
real_t normal[] = NULL )

Rotate the NURBSPatch in 2D or 3D..

A rotation of a 2D NURBS-patch requires an angle only. Rotating a 3D NURBS-patch requires a normal as well.

Definition at line 1710 of file nurbs.cpp.

◆ Rotate2D()

void mfem::NURBSPatch::Rotate2D ( real_t angle)

Rotate the NURBSPatch, 2D case.

Definition at line 1739 of file nurbs.cpp.

◆ Rotate3D()

void mfem::NURBSPatch::Rotate3D ( real_t normal[],
real_t angle )

Rotate the NURBSPatch, 3D case.

Definition at line 1806 of file nurbs.cpp.

◆ SetKnotVectorsCoarse()

void mfem::NURBSPatch::SetKnotVectorsCoarse ( bool c)

Marks the KnotVector in each dimension as coarse.

Definition at line 1962 of file nurbs.cpp.

◆ SetLoopDirection()

int mfem::NURBSPatch::SetLoopDirection ( int dir)
protected

Flattens the B-NET in direction dir, producing a 1D net. Returns the number of variables per knot in flattened structure.

Definition at line 907 of file nurbs.cpp.

◆ slice() [1/2]

real_t & mfem::NURBSPatch::slice ( int i,
int j )
inlineprotected

Access function for the effectively 1D flattened net, where i is a knot index, and j is an index of a variable per knot.

Definition at line 1038 of file nurbs.hpp.

◆ slice() [2/2]

const real_t & mfem::NURBSPatch::slice ( int i,
int j ) const
inlineprotected

Definition at line 1049 of file nurbs.hpp.

◆ swap()

void mfem::NURBSPatch::swap ( NURBSPatch * np)
protected

Deletes own data, takes data from np, and deletes np.

Definition at line 844 of file nurbs.cpp.

◆ SwapDirections()

void mfem::NURBSPatch::SwapDirections ( int dir1,
int dir2 )

Swap data and KnotVectors in directions dir1 and dir2.

Note
Direction pairs (0,2) and (2,0) are not supported, resulting in an error being thrown.

Definition at line 1685 of file nurbs.cpp.

◆ UniformRefinement() [1/2]

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

Definition at line 982 of file nurbs.cpp.

◆ UniformRefinement() [2/2]

void mfem::NURBSPatch::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.

Parameters
[in]rfOptional refinement factor. If scalar, the factor is used for all dimensions. If an array, factors can be specified for each dimension.

Definition at line 995 of file nurbs.cpp.

Friends And Related Symbol Documentation

◆ Interpolate

NURBSPatch * Interpolate ( NURBSPatch & p1,
NURBSPatch & p2 )
friend

Given two patches p1 and p2 of the same dimensions, create and return a new patch by merging their knots and data.

Note
The returned object should be deleted by the caller.

Definition at line 1855 of file nurbs.cpp.

◆ Revolve3D

NURBSPatch * Revolve3D ( NURBSPatch & patch,
real_t n[],
real_t ang,
int times )
friend

Create and return a new patch by revolving patch in 3D.

Note
The returned object should be deleted by the caller.

Definition at line 1902 of file nurbs.cpp.

Member Data Documentation

◆ data

real_t* mfem::NURBSPatch::data
protected

Data with the layout (Dim x ni x nj x nk)

Definition at line 222 of file nurbs.hpp.

◆ Dim

int mfem::NURBSPatch::Dim
protected

Physical dimension plus 1.

Definition at line 219 of file nurbs.hpp.

◆ kv

Array<KnotVector *> mfem::NURBSPatch::kv
protected

KnotVectors in each direction.

Definition at line 225 of file nurbs.hpp.

◆ ls

int mfem::NURBSPatch::ls
protected

Definition at line 239 of file nurbs.hpp.

◆ nd

int mfem::NURBSPatch::nd
protected

Definition at line 238 of file nurbs.hpp.

◆ ni

int mfem::NURBSPatch::ni
protected

B-NET dimensions.

Definition at line 216 of file nurbs.hpp.

◆ nj

int mfem::NURBSPatch::nj
protected

Definition at line 216 of file nurbs.hpp.

◆ nk

int mfem::NURBSPatch::nk
protected

Definition at line 216 of file nurbs.hpp.

◆ sd

int mfem::NURBSPatch::sd
protected

Definition at line 240 of file nurbs.hpp.


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