OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
feibspline.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #ifndef feibspline_h
36 #define feibspline_h
37 
38 #include "feinterpol.h"
39 #include "floatarray.h"
40 
42 
43 #define _IFT_BSplineInterpolation_degree "degree"
44 #define _IFT_BSplineInterpolation_knotVectorU "knotvectoru"
45 #define _IFT_BSplineInterpolation_knotVectorV "knotvectorv"
46 #define _IFT_BSplineInterpolation_knotVectorW "knotvectorw"
47 #define _IFT_BSplineInterpolation_knotMultiplicityU "knotmultiplicityu"
48 #define _IFT_BSplineInterpolation_knotMultiplicityV "knotmultiplicityv"
49 #define _IFT_BSplineInterpolation_knotMultiplicityW "knotmultiplicityw"
50 
51 
52 namespace oofem {
53 class FloatMatrix;
54 class FloatArray;
55 class IntArray;
56 
60 class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation
61 {
62 protected:
64  int nsd;
66  int *degree; // eg. 2
68  FloatArray *knotValues; // eg. 0 1 2 3 4 5
70  IntArray *knotMultiplicity; // eg. 3 1 1 1 2 3
72 
78  double **knotVector; // eg. 0 0 0 1 2 3 4 4 5 5 5
80  int *numberOfKnotSpans; // eg. 5 (0-1,1-2,2-3,3-4,4-5)
81 public:
83  this->nsd = nsd;
84  }
85  virtual ~BSplineInterpolation();
86 
88  if ( nsd == 3 ) {
89  return _Cube;
90  } else if ( nsd == 2 ) {
91  return _Square;
92  } else if ( nsd == 1 ) {
93  return _Line;
94  } else {
96  }
97  }
98  virtual Element_Geometry_Type giveGeometryType() const { return EGT_unknown; }
99 
101  if ( nsd == 3 ) {
102  return _Square;
103  } else if ( nsd == 2 ) {
104  return _Line;
105  } else if ( nsd == 1 ) {
106  return _Point;
107  } else {
109  }
110  }
112  if ( nsd == 3 ) {
113  return _Square;
114  } else if ( nsd == 2 ) {
115  return _Square;
116  } else {
118  }
119  }
121  if ( nsd >= 2 ) {
122  return _Line;
123  } else {
125  }
126  }
127 
128 
129 
130  virtual int giveNsd() { return nsd; }
131  virtual IRResultType initializeFrom(InputRecord *ir);
132 
133  virtual void boundaryEdgeGiveNodes(IntArray &answer, int boundary)
134  { OOFEM_ERROR("Functions not supported for this interpolator."); }
135  virtual void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
136  { OOFEM_ERROR("Functions not supported for this interpolator."); }
137  virtual double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
138  { OOFEM_ERROR("Functions not supported for this interpolator.");
139  return 0.; }
140  virtual void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
141  { OOFEM_ERROR("Functions not supported for this interpolator."); }
142 
143 
146  virtual void boundarySurfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) {OOFEM_ERROR("Functions not supported for this interpolator."); }
147  virtual void boundarySurfaceEvaldNdx(FloatMatrix &answer, int isurf,
148  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
149  { OOFEM_ERROR("Functions not supported for this interpolator."); }
150  virtual double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords,
151  const FEICellGeometry &cellgeo)
152  { OOFEM_ERROR("Functions not supported for this interpolator."); }
153  virtual void boundarySurfaceLocal2global(FloatArray &answer, int isurf,
154  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
155  { OOFEM_ERROR("Functions not supported for this interpolator."); }
156  virtual double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords,
157  const FEICellGeometry &cellgeo)
158  { OOFEM_ERROR("Functions not supported for this interpolator."); }
159  virtual void boundarySurfaceGiveNodes(IntArray &answer, int boundary)
160  { OOFEM_ERROR("Functions not supported for this interpolator."); }
161 
163 
164 
165 
166 
167  virtual void boundaryGiveNodes(IntArray &answer, int boundary)
168  { OOFEM_ERROR("Not implemented"); }
169  virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
170  { OOFEM_ERROR("Not implemented"); }
171  virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
172  { OOFEM_ERROR("Not implemented");
173  return 0.; }
174  virtual double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
175  { OOFEM_ERROR("boundaryGiveTransformationJacobian - Not implemented");
176  return 0.; }
177  virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
178  { OOFEM_ERROR("boundaryLocal2Global - Not implemented"); }
179 
180 
181  virtual int giveNumberOfKnotSpans(int dim) { return numberOfKnotSpans [ dim - 1 ]; }
182  virtual int giveNumberOfControlPoints(int dim) { return numberOfControlPoints [ dim - 1 ]; }
183  virtual const double *const *giveKnotVector() {
184  return this->knotVector;
185  }
186  virtual const IntArray *giveKnotMultiplicity(int dim) { return & this->knotMultiplicity [ dim - 1 ]; }
187  virtual const FloatArray *giveKnotValues(int dim) { return & this->knotValues [ dim - 1 ]; }
188  virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo);
189  virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo);
190  virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo);
191  virtual int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) {
192  OOFEM_ERROR("Not yet implemented.");
193  return 0;
194  }
195  virtual void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo);
196  virtual int giveKnotSpanBasisFuncMask(const IntArray &knotSpan, IntArray &mask);
197  virtual int giveNumberOfKnotSpanBasisFunctions(const IntArray &knotSpan);
198 
199  virtual const char *giveClassName() const { return "BSplineInterpolation"; }
200  virtual bool hasSubPatchFormulation() { return true; }
201 
203  { OOFEM_ERROR("Not supported.");
204  return NULL; }
205  virtual IntegrationRule *giveBoundaryIntegrationRule(int order, int boundary)
206  { OOFEM_ERROR("Not supported.");
207  return NULL; }
208  virtual IntegrationRule *giveBoundaryEdgeIntegrationRule(int order, int boundary)
209  { OOFEM_ERROR("Not supported.");
210  return NULL; }
211 
212 protected:
222  void basisFuns(FloatArray &N, int span, double u, int p, const double *U);
244  void dersBasisFuns(int n, double u, int span, int p, double *const U, FloatMatrix &ders);
259  int findSpan(int n, int p, double u, const double *U) const;
263  void giveNonzeroBasisFuncInterval(int span, int deg, int &s, int &e) {
264  s = span - deg;
265  e = span;
266  }
267 };
268 } // end namespace oofem
269 #endif // feibspline_h
IntArray * knotMultiplicity
Knot multiplicity [nsd].
Definition: feibspline.h:70
integrationDomain
Used by integrator class to supply integration points for proper domain to be integrated (Area...
Interpolation for B-splines.
Definition: feibspline.h:60
virtual double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the normal out of the surface at given point.
Definition: feibspline.h:150
virtual void boundarySurfaceGiveNodes(IntArray &answer, int boundary)
Gives the boundary nodes for requested boundary number.
Definition: feibspline.h:159
Element_Geometry_Type
Enumerative type used to classify element geometry Possible values are: EGT_point - point in space EG...
virtual const FloatArray * giveKnotValues(int dim)
Returns the knot values of the receiver.
Definition: feibspline.h:187
int * numberOfKnotSpans
Nonzero spans in each directions [nsd].
Definition: feibspline.h:80
virtual int giveNumberOfControlPoints(int dim)
Definition: feibspline.h:182
int * degree
Degree in each direction.
Definition: feibspline.h:66
Class representing a general abstraction for cell geometry.
Definition: feinterpol.h:62
virtual const char * giveClassName() const
Definition: feibspline.h:199
virtual Element_Geometry_Type giveGeometryType() const
Returns the geometry type fo the interpolator.
Definition: feibspline.h:98
virtual const IntArray * giveKnotMultiplicity(int dim)
Returns the knot multiplicity of the receiver.
Definition: feibspline.h:186
virtual void boundaryEdgeGiveNodes(IntArray &answer, int boundary)
Gives the boundary nodes for requested boundary number.
Definition: feibspline.h:133
Class implementing an array of integers.
Definition: intarray.h:61
virtual double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation Jacobian on the requested boundary.
Definition: feibspline.h:174
Abstract base class representing integration rule.
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
virtual int giveNsd()
Returns number of spatial dimensions.
Definition: feibspline.h:130
virtual const double *const * giveKnotVector()
Returns the subdivision of patch parametric space.
Definition: feibspline.h:183
#define OOFEM_ERROR(...)
Definition: error.h:61
double ** knotVector
Knot vectors [nsd][knot_vector_size].
Definition: feibspline.h:78
virtual double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: feibspline.h:156
virtual void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Maps the local boundary coordinates to global.
Definition: feibspline.h:140
FloatArray * knotValues
Knot values [nsd].
Definition: feibspline.h:68
#define N(p, q)
Definition: mdm.C:367
virtual integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const
Returns boundary integration domain.
Definition: feibspline.h:111
virtual void boundaryGiveNodes(IntArray &answer, int boundary)
Gives the boundary nodes for requested boundary number.
Definition: feibspline.h:167
virtual IntegrationRule * giveIntegrationRule(int order)
Sets up a suitable integration rule for numerical integrating over volume.
Definition: feibspline.h:202
virtual double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the normal on the requested boundary.
Definition: feibspline.h:171
virtual integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const
Returns boundary integration domain.
Definition: feibspline.h:120
virtual IntegrationRule * giveBoundaryEdgeIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Definition: feibspline.h:208
virtual bool hasSubPatchFormulation()
Returns true, if receiver is formulated on sub-patch basis.
Definition: feibspline.h:200
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void boundarySurfaceEvaldNdx(FloatMatrix &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
Definition: feibspline.h:147
virtual integrationDomain giveBoundaryIntegrationDomain(int ib) const
Returns boundary integration domain.
Definition: feibspline.h:100
virtual void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the basis functions on the requested boundary.
Definition: feibspline.h:169
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates local coordinates from given global ones.
Definition: feibspline.h:191
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual void boundarySurfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
Definition: feibspline.h:146
virtual integrationDomain giveIntegrationDomain() const
Returns the integration domain of the interpolator.
Definition: feibspline.h:87
virtual int giveNumberOfKnotSpans(int dim)
Returns the number of knot spans of the receiver.
Definition: feibspline.h:181
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Definition: feibspline.h:205
virtual double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the determinant of the transformation Jacobian on the requested boundary.
Definition: feibspline.h:137
virtual void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the basis functions on the requested boundary.
Definition: feibspline.h:135
virtual void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Maps the local boundary coordinates to global.
Definition: feibspline.h:177
int * numberOfControlPoints
numberOfControlPoints[nsd]
Definition: feibspline.h:76
the oofem namespace is to define a context or scope in which all oofem names are defined.
void giveNonzeroBasisFuncInterval(int span, int deg, int &s, int &e)
Returns the range of nonzero basis functions for given knot span and given degree.
Definition: feibspline.h:263
virtual void boundarySurfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: feibspline.h:153
int nsd
Number of spatial directions.
Definition: feibspline.h:64

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011