IFEM 90A354
ASMLRSpline.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _ASM_LR_SPLINE_H
15#define _ASM_LR_SPLINE_H
16
17#include "ASMbase.h"
18#include "ASMunstruct.h"
19#include "ThreadGroups.h"
20
21#include "GoTools/geometry/BsplineBasis.h"
22
23
24namespace LR
25{
26 class Basisfunction;
27 class LRSpline;
28
34 int extendControlPoints(LRSpline* basis, const Vector& v,
35 int nf, int ofs = 0);
36
42 void contractControlPoints(LRSpline* basis, Vector& v,
43 int nf, int ofs = 0);
44
52 void getGaussPointParameters(const LRSpline* spline, RealArray& uGP,
53 int d, int nGauss, int iel, const double* xi);
54
59 void generateThreadGroups(ThreadGroups& threadGroups,
60 const LRSpline* lr,
61 const std::vector<LRSpline*>& addConstraints = {});
62
66 void createMNPC(const LR::LRSpline* basis, IntMat& result);
67}
68
69
75class ASMLRSpline : public ASMbase, public ASMunstruct
76{
77protected:
82 ASMLRSpline(unsigned char n_p, unsigned char n_s, unsigned char n_f);
86 ASMLRSpline(const ASMLRSpline& patch, unsigned char n_f);
87
88public:
90 virtual ~ASMLRSpline() {}
91
93 virtual bool empty() const { return geomB == nullptr; }
94
96 virtual bool getParameterDomain(Real2DMat&, IntVec*) const;
97
99 const LR::LRSpline* getRefinementBasis() const { return refB.get(); }
100
104 virtual bool refine(const LR::RefineData& prm, Vectors& sol);
105
109 virtual LR::LRSpline* evalSolution(const IntegrandBase& integrand) const = 0;
110
112 static Go::BsplineBasis getBezierBasis(int p,
113 double start = -1.0, double end = 1.0);
114
116 IntVec getFunctionsForElements(const IntVec& elements,
117 bool globalId = false) const;
119 void getFunctionsForElements(IntSet& functions, const IntVec& elements,
120 bool globalId = true) const;
121
123 static void Sort(int u, int v, int orient,
124 std::vector<LR::Basisfunction*>& functions);
125
130 virtual IntVec getBoundaryCovered(const IntSet& nodes) const;
131
140 IntVec getOverlappingNodes(const IntSet& nodes, int dir = 7) const;
141
146 IntVec getOverlappingNodes(int node, int dir = 7) const
147 {
148 return this->getOverlappingNodes(IntSet(&node,(&node)+1),dir);
149 }
150
156 virtual bool transferGaussPtVars(const LR::LRSpline* oldBasis,
157 const RealArray& oldVar, RealArray& newVar,
158 int nGauss) const = 0;
164 virtual bool transferGaussPtVarsN(const LR::LRSpline* oldBasis,
165 const RealArray& oldVar, RealArray& newVar,
166 int nGauss) const = 0;
171 virtual bool transferCntrlPtVars(const LR::LRSpline* oldBasis,
172 RealArray& newVar, int nGauss) const = 0;
179 bool transferCntrlPtVars(LR::LRSpline* oldBasis,
180 const RealArray& oldVar, RealArray& newVar,
181 int nGauss, int nf = 1) const;
182
184 virtual std::pair<size_t,double> findClosestNode(const Vec3& X) const;
185
187 virtual Vec3 getElementCenter(int iel) const;
188
190 virtual void getNoIntPoints(size_t& nPt, size_t& nIPt);
191
193 virtual void swapProjectionBasis();
194
195protected:
199 bool doRefine(const LR::RefineData& prm, LR::LRSpline* lrspline);
200
201 using ASMbase::evalPoint;
203 virtual int evalPoint(int iel, const double* param, Vec3& X) const = 0;
204
209 static bool checkThreadGroups(const IntMat& groups,
210 const std::vector<const LR::LRSpline*>& bases,
211 const LR::LRSpline* threadBasis);
212
213 std::shared_ptr<LR::LRSpline> geomB;
214 std::shared_ptr<LR::LRSpline> projB;
215 std::shared_ptr<LR::LRSpline> projB2;
216 std::shared_ptr<LR::LRSpline> refB;
217
221};
222
223#endif
Base class for spline-based finite element (FE) assembly drivers.
std::vector< int > IntVec
General integer vector.
Definition ASMbase.h:25
std::vector< IntVec > IntMat
General 2D integer matrix.
Definition ASMbase.h:26
Abstract interface for unstructured FE assembly drivers.
std::set< int > IntSet
General integer set.
Definition ASMunstruct.h:22
std::vector< RealArray > Real2DMat
A real-valued two-dimensional array without algebraic operations.
Definition ImmersedBoundaries.h:34
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition ImmersedBoundaries.h:32
std::vector< Vector > Vectors
An array of real-valued vectors with algebraic operations.
Definition MatVec.h:37
Threading group partitioning.
Base class for LR B-spline FE assembly drivers.
Definition ASMLRSpline.h:76
std::shared_ptr< LR::LRSpline > refB
Pointer to spline object of the refinement basis.
Definition ASMLRSpline.h:216
IntVec getOverlappingNodes(const IntSet &nodes, int dir=7) const
Returns all functions whose support overlap with the input nodes.
Definition ASMLRSpline.C:387
virtual void swapProjectionBasis()
Swaps between the first and second projection basis.
Definition ASMLRSpline.C:583
bool doRefine(const LR::RefineData &prm, LR::LRSpline *lrspline)
Refines the mesh adaptively.
Definition ASMLRSpline.C:280
virtual bool transferGaussPtVarsN(const LR::LRSpline *oldBasis, const RealArray &oldVar, RealArray &newVar, int nGauss) const =0
Transfers Gauss point variables from old basis to this patch.
std::shared_ptr< LR::LRSpline > projB
Pointer to spline object of the projection basis.
Definition ASMLRSpline.h:214
ThreadGroups proj2ThreadGroups
Element groups for multi-threaded assembly - second projection basis.
Definition ASMLRSpline.h:220
virtual void getNoIntPoints(size_t &nPt, size_t &nIPt)
Computes the total number of integration points in this patch.
Definition ASMLRSpline.C:555
virtual LR::LRSpline * evalSolution(const IntegrandBase &integrand) const =0
Projects the secondary solution field onto the primary basis.
virtual bool refine(const LR::RefineData &prm, Vectors &sol)
Refines the mesh adaptively.
Definition ASMLRSpline.C:219
ThreadGroups projThreadGroups
Element groups for multi-threaded assembly - projection basis.
Definition ASMLRSpline.h:219
virtual std::pair< size_t, double > findClosestNode(const Vec3 &X) const
Finds the node that is closest to the given point X.
Definition ASMLRSpline.C:449
virtual bool getParameterDomain(Real2DMat &, IntVec *) const
Returns parameter values and node numbers of the domain corners.
Definition ASMLRSpline.C:519
virtual Vec3 getElementCenter(int iel) const
Returns the coordinates of the element center.
Definition ASMLRSpline.C:467
virtual bool transferCntrlPtVars(const LR::LRSpline *oldBasis, RealArray &newVar, int nGauss) const =0
Transfers control point variables from old basis to this patch.
std::shared_ptr< LR::LRSpline > projB2
Pointer to spline object of the secondary projection basis.
Definition ASMLRSpline.h:215
ThreadGroups threadGroups
Element groups for multi-threaded assembly.
Definition ASMLRSpline.h:218
virtual ~ASMLRSpline()
Empty destructor.
Definition ASMLRSpline.h:90
const LR::LRSpline * getRefinementBasis() const
Returns a const pointer to refinement basis.
Definition ASMLRSpline.h:99
virtual bool empty() const
Checks if the patch is empty.
Definition ASMLRSpline.h:93
static Go::BsplineBasis getBezierBasis(int p, double start=-1.0, double end=1.0)
Returns a Bezier basis of order p.
Definition ASMLRSpline.C:336
std::shared_ptr< LR::LRSpline > geomB
Pointer to spline object of the geometry basis.
Definition ASMLRSpline.h:213
IntVec getFunctionsForElements(const IntVec &elements, bool globalId=false) const
Returns a list of basis functions having support on given elements.
Definition ASMLRSpline.C:345
virtual int evalPoint(int iel, const double *param, Vec3 &X) const =0
Evaluates the geometry at a specified point.
static bool checkThreadGroups(const IntMat &groups, const std::vector< const LR::LRSpline * > &bases, const LR::LRSpline *threadBasis)
Santity check thread groups.
Definition ASMLRSpline.C:491
IntVec getOverlappingNodes(int node, int dir=7) const
Returns all functions whose support overlap with the input node.
Definition ASMLRSpline.h:146
virtual IntVec getBoundaryCovered(const IntSet &nodes) const
Returns all boundary functions that are covered by the given nodes.
Definition ASMLRSpline.C:369
static void Sort(int u, int v, int orient, std::vector< LR::Basisfunction * > &functions)
Sort basis functions based on local knot vectors.
Definition ASMLRSpline.C:413
virtual bool transferGaussPtVars(const LR::LRSpline *oldBasis, const RealArray &oldVar, RealArray &newVar, int nGauss) const =0
Transfers Gauss point variables from old basis to this patch.
Base class for spline-based finite element (FE) assembly drivers.
Definition ASMbase.h:72
unsigned char nf
Number of primary solution fields (1 or larger)
Definition ASMbase.h:1057
virtual int evalPoint(const double *xi, double *param, Vec3 &X) const =0
Evaluates the geometry at a specified point.
int nGauss
Numerical integration scheme for this patch.
Definition ASMbase.h:1090
virtual bool evalSolution(Matrix &sField, const Vector &locSol, const int *npe, int n_f=0, bool piola=false) const
Evaluates the primary solution field at all visualization points.
Definition ASMbase.C:1797
Abstract interface for unstructured spline patches.
Definition ASMunstruct.h:64
Base class representing a system level integrated quantity.
Definition IntegrandBase.h:42
Class containing threading group partitioning.
Definition ThreadGroups.h:26
Simple class for representing a point in 3D space.
Definition Vec3.h:27
A vector class with some added algebraic operations.
Definition matrix.h:64
Utilities for LR-splines.
Definition AdaptiveSetup.h:24
void generateThreadGroups(ThreadGroups &threadGroups, const LRSpline *lr, const std::vector< LRSpline * > &addConstraints={})
Generates thread groups for a LR-spline mesh.
Definition ASMLRSpline.C:95
void getGaussPointParameters(const LRSpline *spline, RealArray &uGP, int d, int nGauss, int iel, const double *xi)
Extracts parameter values of the Gauss points in one direction.
Definition ASMLRSpline.C:73
void createMNPC(const LR::LRSpline *basis, IntMat &result)
Createss the matrix of nodal point correspondance for a LR-spline.
Definition ASMLRSpline.C:187
int extendControlPoints(LRSpline *basis, const Vector &v, int nf, int ofs=0)
Expands the basis coefficients of an LR-spline object.
Definition ASMLRSpline.C:32
void contractControlPoints(LRSpline *basis, Vector &v, int nf, int ofs=0)
Contracts the basis coefficients of an LR-spline object.
Definition ASMLRSpline.C:58
A struct of data to control the mesh refinement.
Definition ASMunstruct.h:44