G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMPBESUtils.h
1#pragma once
2
5
9
10#include <gsIO/gsFileData.h>
11#include <gsIO/gsReadFile.h>
12
13namespace gismo
14{
15
16template<short_t d, class T>
17gsMPBESBasis<d,T> * getCompBasisFromMultiPatch(const gsMultiPatch<T> & mp,index_t incrSmoothness = -1,index_t minEVDistance = -1 )
18{
19 gsMPBESBasis<d,T> * compBasis=NULL;
20 bool tensorBSpline= true;
21 bool hTensor = true;
22 std::vector<gsTensorBSplineBasis<d,T>* >tensorBases;
23 for(size_t i = 0;i<mp.nPatches();++i)
24 {
25 tensorBases.push_back(dynamic_cast<gsTensorBSplineBasis<d,T> * >(& mp.basis(i)));
26 tensorBSpline = tensorBSpline && tensorBases[i]!=NULL;
27 }
28 if(tensorBSpline)
29 compBasis = (new gsMPBESBSplineBasis<d,T>(tensorBases,mp,incrSmoothness,minEVDistance));
30 else
31 {
32 std::vector<gsHTensorBasis<d,T>* >hBases;
33 for(size_t i = 0;i<mp.nPatches();++i)
34 {
35 hBases.push_back(dynamic_cast<gsHTensorBasis<d,T> * >(& mp.basis(i)));
36 hTensor = hTensor && hBases[i]!=NULL;
37 }
38 if(hTensor)
39 compBasis = (new gsMPBESHSplineBasis<d,T>(hBases,mp,incrSmoothness,minEVDistance));
40 }
41 GISMO_ASSERT(tensorBSpline||hTensor,"No suitable basis for gsMappedBasis found.");
42 return compBasis;
43}
44
45template<short_t d, class T>
46gsMPBESBasis<d,T> * getCompBasisFromMultiPatch_withCoefs(const gsMultiPatch<T> & mp, std::vector<gsMatrix<T>* >&coefs,index_t incrSmoothness = -1,index_t minEVDistance = -1 )
47{
48 gsMPBESBasis<d,T> * compBasis=NULL;
49 bool tensorBSpline= true;
50 bool hTensor = true;
51 std::vector<gsTensorBSplineBasis<d,T>* >tensorBases;
52 for(size_t i = 0;i<mp.nPatches();++i)
53 {
54 tensorBases.push_back(dynamic_cast<gsTensorBSplineBasis<d,T> * >(& mp.basis(i)));
55 tensorBSpline = tensorBSpline && tensorBases[i]!=NULL;
56 }
57 if(tensorBSpline)
58 compBasis = (new gsMPBESBSplineBasis<d,T>(tensorBases,mp,coefs,incrSmoothness,minEVDistance));
59 else
60 {
61 std::vector<gsHTensorBasis<d,T>* >hBases;
62 for(size_t i = 0;i<mp.nPatches();++i)
63 {
64 hBases.push_back(dynamic_cast<gsHTensorBasis<d,T> * >(& mp.basis(i)));
65 hTensor = hTensor && hBases[i]!=NULL;
66 }
67 if(hTensor)
68 compBasis = (new gsMPBESHSplineBasis<d,T>(hBases,mp,coefs,incrSmoothness,minEVDistance));
69 }
70 GISMO_ASSERT(tensorBSpline||hTensor,"No suitable basis for gsMappedBasis found.");
71 return compBasis;
72}
73
74} // end namespace gismo
#define index_t
Definition gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Utility class which holds I/O XML data to read/write to/from files.
Provides definition of HTensorBasis abstract interface.
Provides declaration of Basis abstract interface.
Provides declaration of Basis abstract interface.
Provides declaration of Basis abstract interface.
Utility class which holds I/O XML data to read/write to/from files.
Provides declaration of THBSplineBasis class.
The G+Smo namespace, containing all definitions for the library.