| 1 |
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE |
| 2 |
// |
| 3 |
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, |
| 4 |
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
| 5 |
// |
| 6 |
// This library is free software; you can redistribute it and/or |
| 7 |
// modify it under the terms of the GNU Lesser General Public |
| 8 |
// License as published by the Free Software Foundation; either |
| 9 |
// version 2.1 of the License, or (at your option) any later version. |
| 10 |
// |
| 11 |
// This library is distributed in the hope that it will be useful, |
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
// Lesser General Public License for more details. |
| 15 |
// |
| 16 |
// You should have received a copy of the GNU Lesser General Public |
| 17 |
// License along with this library; if not, write to the Free Software |
| 18 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 |
// |
| 20 |
// See http://www.salome-platform.org/ or email : [email protected] |
| 21 |
// |
| 22 |
#ifndef MED_GaussUtils_HeaderFile |
| 23 |
#define MED_GaussUtils_HeaderFile |
| 24 |
|
| 25 |
#include "MED_WrapperBase.hxx" |
| 26 |
|
| 27 |
#include "MED_Structures.hxx" |
| 28 |
|
| 29 |
namespace MED |
| 30 |
{ |
| 31 |
//--------------------------------------------------------------- |
| 32 |
typedef TVector<TCCoordSlice> TCCoordSliceArr; |
| 33 |
typedef TVector<TCoordSlice> TCoordSliceArr; |
| 34 |
|
| 35 |
//! Define a helper class to handle Gauss Points coordinates |
| 36 |
class MEDWRAPPER_EXPORT TGaussCoord: |
| 37 |
virtual TModeSwitchInfo |
| 38 |
{ |
| 39 |
TInt myNbElem; |
| 40 |
TInt myNbGauss; |
| 41 |
TInt myDim; |
| 42 |
|
| 43 |
TInt myGaussStep; |
| 44 |
|
| 45 |
TNodeCoord myGaussCoord; |
| 46 |
|
| 47 |
public: |
| 48 |
|
| 49 |
TGaussCoord(); |
| 50 |
|
| 51 |
//! To init the class |
| 52 |
void |
| 53 |
Init(TInt theNbElem, |
| 54 |
TInt theNbGauss, |
| 55 |
TInt theDim, |
| 56 |
EModeSwitch theMode = eFULL_INTERLACE); |
| 57 |
|
| 58 |
TInt |
| 59 |
GetNbElem() const; |
| 60 |
|
| 61 |
TInt |
| 62 |
GetNbGauss() const; |
| 63 |
|
| 64 |
TInt |
| 65 |
GetDim() const; |
| 66 |
|
| 67 |
unsigned char* |
| 68 |
GetValuePtr(); |
| 69 |
|
| 70 |
//! Get slice of the coordinate that corresponds to defined cell (const version) |
| 71 |
TCCoordSliceArr |
| 72 |
GetCoordSliceArr(TInt theElemId) const; |
| 73 |
|
| 74 |
//! Get slice of the coordinate that corresponds to defined cell |
| 75 |
TCoordSliceArr |
| 76 |
GetCoordSliceArr(TInt theElemId); |
| 77 |
}; |
| 78 |
typedef SharedPtr<TGaussCoord> PGaussCoord; |
| 79 |
|
| 80 |
|
| 81 |
//--------------------------------------------------------------- |
| 82 |
//! To calculate Gauss Points coordinates |
| 83 |
MEDWRAPPER_EXPORT |
| 84 |
bool |
| 85 |
GetGaussCoord3D(const TGaussInfo& theGaussInfo, |
| 86 |
const TCellInfo& theCellInfo, |
| 87 |
const TNodeInfo& theNodeInfo, |
| 88 |
TGaussCoord& theGaussCoord, |
| 89 |
const TElemNum& theElemNum = TElemNum(), |
| 90 |
EModeSwitch theMode = eFULL_INTERLACE); |
| 91 |
|
| 92 |
|
| 93 |
//--------------------------------------------------------------- |
| 94 |
//! To calculate Gauss Points coordinates for defined TCellInfo as its bary center |
| 95 |
MEDWRAPPER_EXPORT |
| 96 |
bool |
| 97 |
GetBaryCenter(const TCellInfo& theCellInfo, |
| 98 |
const TNodeInfo& theNodeInfo, |
| 99 |
TGaussCoord& theGaussCoord, |
| 100 |
const TElemNum& theElemNum = TElemNum(), |
| 101 |
EModeSwitch theMode = eFULL_INTERLACE); |
| 102 |
|
| 103 |
//! To calculate Gauss Points coordinates for defined TPolygoneInfo as its bary center |
| 104 |
MEDWRAPPER_EXPORT |
| 105 |
bool |
| 106 |
GetBaryCenter(const TPolygoneInfo& thePolygoneInfo, |
| 107 |
const TNodeInfo& theNodeInfo, |
| 108 |
TGaussCoord& theGaussCoord, |
| 109 |
const TElemNum& theElemNum = TElemNum(), |
| 110 |
EModeSwitch theMode = eFULL_INTERLACE); |
| 111 |
|
| 112 |
//! To calculate Gauss Points coordinates for defined TPolyedreInfo as its bary center |
| 113 |
MEDWRAPPER_EXPORT |
| 114 |
bool |
| 115 |
GetBaryCenter(const TPolyedreInfo& thePolyedreInfo, |
| 116 |
const TNodeInfo& theNodeInfo, |
| 117 |
TGaussCoord& theGaussCoord, |
| 118 |
const TElemNum& theElemNum = TElemNum(), |
| 119 |
EModeSwitch theMode = eFULL_INTERLACE); |
| 120 |
|
| 121 |
//--------------------------------------------------------------- |
| 122 |
//! Shape function definitions |
| 123 |
//--------------------------------------------------------------- |
| 124 |
struct MEDWRAPPER_EXPORT TShapeFun |
| 125 |
{ |
| 126 |
class TFun; |
| 127 |
|
| 128 |
TFloatVector myRefCoord; |
| 129 |
TInt myDim; |
| 130 |
TInt myNbRef; |
| 131 |
|
| 132 |
TShapeFun(TInt theDim = 0, TInt theNbRef = 0); |
| 133 |
|
| 134 |
TInt GetNbRef() const { return myNbRef; } |
| 135 |
|
| 136 |
TCCoordSlice GetCoord(TInt theRefId) const; |
| 137 |
|
| 138 |
TCoordSlice GetCoord(TInt theRefId); |
| 139 |
|
| 140 |
void GetFun(const TCCoordSliceArr& theRef, |
| 141 |
const TCCoordSliceArr& theGauss, |
| 142 |
TFun& theFun) const; |
| 143 |
virtual |
| 144 |
void InitFun(const TCCoordSliceArr& theRef, |
| 145 |
const TCCoordSliceArr& theGauss, |
| 146 |
TFun& theFun) const = 0; |
| 147 |
virtual |
| 148 |
bool IsSatisfy(const TCCoordSliceArr& theRefCoord) const; |
| 149 |
|
| 150 |
bool Eval(const TCellInfo& theCellInfo, |
| 151 |
const TNodeInfo& theNodeInfo, |
| 152 |
const TElemNum& theElemNum, |
| 153 |
const TCCoordSliceArr& theRef, |
| 154 |
const TCCoordSliceArr& theGauss, |
| 155 |
TGaussCoord& theGaussCoord, |
| 156 |
EModeSwitch theMode); |
| 157 |
}; |
| 158 |
//--------------------------------------------------------------- |
| 159 |
struct TSeg2a: TShapeFun { |
| 160 |
TSeg2a(); |
| 161 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 162 |
const TCCoordSliceArr& theGauss, |
| 163 |
TFun& theFun) const; |
| 164 |
}; |
| 165 |
//--------------------------------------------------------------- |
| 166 |
struct TSeg3a: TShapeFun { |
| 167 |
TSeg3a(); |
| 168 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 169 |
const TCCoordSliceArr& theGauss, |
| 170 |
TFun& theFun) const; |
| 171 |
}; |
| 172 |
//--------------------------------------------------------------- |
| 173 |
struct TTria3a: TShapeFun { |
| 174 |
TTria3a(); |
| 175 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 176 |
const TCCoordSliceArr& theGauss, |
| 177 |
TFun& theFun) const; |
| 178 |
}; |
| 179 |
//--------------------------------------------------------------- |
| 180 |
struct TTria6a: TShapeFun { |
| 181 |
TTria6a(); |
| 182 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 183 |
const TCCoordSliceArr& theGauss, |
| 184 |
TFun& theFun) const; |
| 185 |
}; |
| 186 |
//--------------------------------------------------------------- |
| 187 |
struct TTria3b: TShapeFun { |
| 188 |
TTria3b(); |
| 189 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 190 |
const TCCoordSliceArr& theGauss, |
| 191 |
TFun& theFun) const; |
| 192 |
}; |
| 193 |
//--------------------------------------------------------------- |
| 194 |
struct TTria6b: TShapeFun { |
| 195 |
TTria6b(); |
| 196 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 197 |
const TCCoordSliceArr& theGauss, |
| 198 |
TFun& theFun) const; |
| 199 |
}; |
| 200 |
//--------------------------------------------------------------- |
| 201 |
struct TQuad4a: TShapeFun { |
| 202 |
TQuad4a(); |
| 203 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 204 |
const TCCoordSliceArr& theGauss, |
| 205 |
TFun& theFun) const; |
| 206 |
}; |
| 207 |
//--------------------------------------------------------------- |
| 208 |
struct TQuad8a: TShapeFun { |
| 209 |
TQuad8a(); |
| 210 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 211 |
const TCCoordSliceArr& theGauss, |
| 212 |
TFun& theFun) const; |
| 213 |
}; |
| 214 |
//--------------------------------------------------------------- |
| 215 |
struct TQuad9a: TShapeFun { |
| 216 |
TQuad9a(); |
| 217 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 218 |
const TCCoordSliceArr& theGauss, |
| 219 |
TFun& theFun) const; |
| 220 |
}; |
| 221 |
//--------------------------------------------------------------- |
| 222 |
struct TQuad4b: TShapeFun { |
| 223 |
TQuad4b(); |
| 224 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 225 |
const TCCoordSliceArr& theGauss, |
| 226 |
TFun& theFun) const; |
| 227 |
}; |
| 228 |
//--------------------------------------------------------------- |
| 229 |
struct TQuad8b: TShapeFun { |
| 230 |
TQuad8b(); |
| 231 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 232 |
const TCCoordSliceArr& theGauss, |
| 233 |
TFun& theFun) const; |
| 234 |
}; |
| 235 |
//--------------------------------------------------------------- |
| 236 |
struct TQuad9b: TShapeFun { |
| 237 |
TQuad9b(); |
| 238 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 239 |
const TCCoordSliceArr& theGauss, |
| 240 |
TFun& theFun) const; |
| 241 |
}; |
| 242 |
//--------------------------------------------------------------- |
| 243 |
struct TTetra4a: TShapeFun { |
| 244 |
TTetra4a(); |
| 245 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 246 |
const TCCoordSliceArr& theGauss, |
| 247 |
TFun& theFun) const; |
| 248 |
}; |
| 249 |
//--------------------------------------------------------------- |
| 250 |
struct TTetra10a: TShapeFun { |
| 251 |
TTetra10a(); |
| 252 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 253 |
const TCCoordSliceArr& theGauss, |
| 254 |
TFun& theFun) const; |
| 255 |
}; |
| 256 |
//--------------------------------------------------------------- |
| 257 |
struct TTetra4b: TShapeFun { |
| 258 |
TTetra4b(); |
| 259 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 260 |
const TCCoordSliceArr& theGauss, |
| 261 |
TFun& theFun) const; |
| 262 |
}; |
| 263 |
//--------------------------------------------------------------- |
| 264 |
struct TTetra10b: TShapeFun { |
| 265 |
TTetra10b(); |
| 266 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 267 |
const TCCoordSliceArr& theGauss, |
| 268 |
TFun& theFun) const; |
| 269 |
}; |
| 270 |
//--------------------------------------------------------------- |
| 271 |
struct THexa8a: TShapeFun { |
| 272 |
THexa8a(); |
| 273 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 274 |
const TCCoordSliceArr& theGauss, |
| 275 |
TFun& theFun) const; |
| 276 |
}; |
| 277 |
//--------------------------------------------------------------- |
| 278 |
struct THexa20a: TShapeFun { |
| 279 |
THexa20a(TInt theDim = 3, TInt theNbRef = 20); |
| 280 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 281 |
const TCCoordSliceArr& theGauss, |
| 282 |
TFun& theFun) const; |
| 283 |
}; |
| 284 |
//--------------------------------------------------------------- |
| 285 |
struct THexa27a: THexa20a { |
| 286 |
THexa27a(); |
| 287 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 288 |
const TCCoordSliceArr& theGauss, |
| 289 |
TFun& theFun) const; |
| 290 |
}; |
| 291 |
//--------------------------------------------------------------- |
| 292 |
struct THexa8b: TShapeFun { |
| 293 |
THexa8b(); |
| 294 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 295 |
const TCCoordSliceArr& theGauss, |
| 296 |
TFun& theFun) const; |
| 297 |
}; |
| 298 |
//--------------------------------------------------------------- |
| 299 |
struct THexa20b: TShapeFun { |
| 300 |
THexa20b(TInt theDim = 3, TInt theNbRef = 20); |
| 301 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 302 |
const TCCoordSliceArr& theGauss, |
| 303 |
TFun& theFun) const; |
| 304 |
}; |
| 305 |
//--------------------------------------------------------------- |
| 306 |
struct TPenta6a: TShapeFun { |
| 307 |
TPenta6a(); |
| 308 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 309 |
const TCCoordSliceArr& theGauss, |
| 310 |
TFun& theFun) const; |
| 311 |
}; |
| 312 |
//--------------------------------------------------------------- |
| 313 |
struct TPenta6b: TShapeFun { |
| 314 |
TPenta6b(); |
| 315 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 316 |
const TCCoordSliceArr& theGauss, |
| 317 |
TFun& theFun) const; |
| 318 |
}; |
| 319 |
//--------------------------------------------------------------- |
| 320 |
struct TPenta15a: TShapeFun { |
| 321 |
TPenta15a(); |
| 322 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 323 |
const TCCoordSliceArr& theGauss, |
| 324 |
TFun& theFun) const; |
| 325 |
}; |
| 326 |
//--------------------------------------------------------------- |
| 327 |
struct TPenta15b: TShapeFun { |
| 328 |
TPenta15b(); |
| 329 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 330 |
const TCCoordSliceArr& theGauss, |
| 331 |
TFun& theFun) const; |
| 332 |
}; |
| 333 |
//--------------------------------------------------------------- |
| 334 |
struct TPyra5a: TShapeFun { |
| 335 |
TPyra5a(); |
| 336 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 337 |
const TCCoordSliceArr& theGauss, |
| 338 |
TFun& theFun) const; |
| 339 |
}; |
| 340 |
//--------------------------------------------------------------- |
| 341 |
struct TPyra5b: TShapeFun { |
| 342 |
TPyra5b(); |
| 343 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 344 |
const TCCoordSliceArr& theGauss, |
| 345 |
TFun& theFun) const; |
| 346 |
}; |
| 347 |
//--------------------------------------------------------------- |
| 348 |
struct TPyra13a: TShapeFun { |
| 349 |
TPyra13a(); |
| 350 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 351 |
const TCCoordSliceArr& theGauss, |
| 352 |
TFun& theFun) const; |
| 353 |
}; |
| 354 |
//--------------------------------------------------------------- |
| 355 |
struct TPyra13b: TShapeFun { |
| 356 |
TPyra13b(); |
| 357 |
virtual void InitFun(const TCCoordSliceArr& theRef, |
| 358 |
const TCCoordSliceArr& theGauss, |
| 359 |
TFun& theFun) const; |
| 360 |
}; |
| 361 |
//--------------------------------------------------------------- |
| 362 |
|
| 363 |
} |
| 364 |
|
| 365 |
#endif |