G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsRemapInterface.h
Go to the documentation of this file.
1 
16 #pragma once
17 
19 #include <gsCore/gsBoundary.h>
20 #include <gsIO/gsOptionList.h>
21 
22 namespace gismo {
23 
52 template <class T>
53 class gsRemapInterface : public gsFunction<T>
54 {
55 public:
56 
58  typedef memory::shared_ptr< gsRemapInterface > Ptr;
59 
61  typedef memory::unique_ptr< gsRemapInterface > uPtr;
62 
63 public:
64 
65  enum {
66  neverAffine = -1,
68  };
69 
90  const gsMultiBasis<T> & mb,
91  const boundaryInterface & bi,
92  const gsOptionList & opt = defaultOptions() );
93 
98  {
99  gsOptionList result;
100  result.addInt ( "CheckAffine", "The number of interior points (per direction) in point grid used to "
101  "check if the mapping is affine", 1 );
102  result.addInt ( "NumSamplePoints", "Number of sample points for computing fitting curve (if not affine)", 11 );
103  result.addInt ( "IntervalsOfFittingCurve", "Number of knot space in the fitting curve (if not affine)", 5 );
104  result.addInt ( "DegreeOfFittingCurve", "Spline degree of fitting curve (if not affine)", 3 );
105  result.addReal( "EqualityTolerance", "Points are considered equal iff difference is smaller", 1e-5 );
106  result.addReal( "NewtonTolerance", "Tolerance for Newton solvers", 1e-10 );
107  return result;
108  }
109 
110 public:
111 
116  const typename gsFunction<T>::Ptr & interfaceMap() const { return m_intfMap; }
117 
122  virtual void eval_into(const gsMatrix<T> & u, gsMatrix<T> & result) const;
123 
125  virtual short_t domainDim() const { return m_g1->domainDim(); }
126 
133 
135  bool isMatching() const { return m_isMatching; }
136 
138  bool isAffine() const { return m_isAffine; }
139 
141  const std::vector< std::vector<T> > & breakPoints() const { return m_breakpoints; }
142 
144  virtual std::ostream & print(std::ostream& os) const;
145 
146 private:
147 
149  void constructInterfaceBox();
150 
152  T estimateReparamError(index_t steps) const;
153 
155  void constructFittingCurve(index_t numSamplePoints, index_t intervalsOfFittingCurve,
156  index_t degreeOfFittingCurve);
157 
159  void constructBreaks();
160 
161 private:
162  const gsGeometry<T> * m_g1;
163  const gsGeometry<T> * m_g2;
164 
165  const gsBasis<T> * m_b1;
166  const gsBasis<T> * m_b2;
167 
169 
171  bool m_isAffine;
172 
173  std::vector< std::vector<T> > m_breakpoints;
174 
176 
183 
188 
191 
192 }; // End gsRemapInterface
193 
196 template <class T>
197 inline std::ostream & operator<<(std::ostream & os, const gsRemapInterface<T> & remapIf)
198 { return remapIf.print(os); }
199 
200 } // End namespace gismo
201 
202 #ifndef GISMO_BUILD_LIB
203 #include GISMO_HPP_HEADER(gsRemapInterface.hpp)
204 #endif
boundaryInterface m_bi
Corresponding boundary interface.
Definition: gsRemapInterface.h:168
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
void constructBreaks()
Constructs the breakpoints m_breakpoints.
Definition: gsRemapInterface.hpp:325
const gsBasis< T > * m_b2
Basis on second patch.
Definition: gsRemapInterface.h:166
void constructFittingCurve(index_t numSamplePoints, index_t intervalsOfFittingCurve, index_t degreeOfFittingCurve)
Constructs the fitting curve m_intfMap in the non-affine case.
Definition: gsRemapInterface.hpp:242
gsFunction< T >::Ptr m_intfMap
Iff affine, interface map, otherwise the fitting curve.
Definition: gsRemapInterface.h:175
bool isMatching() const
Returns true iff the interface is matching.
Definition: gsRemapInterface.h:135
#define short_t
Definition: gsConfig.h:35
Provides structs and classes related to interfaces and boundaries.
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the interface map.
Definition: gsRemapInterface.hpp:405
Implements an affine function.
memory::shared_ptr< gsFunction > Ptr
Shared pointer for gsFunction.
Definition: gsFunction.h:65
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
gsMatrix< T > m_parameterBounds1
The bounds of the box that represents .
Definition: gsRemapInterface.h:182
static gsOptionList defaultOptions()
Definition: gsRemapInterface.h:97
gsMatrix< T > m_parameterBounds2
The bounds of the box that represents .
Definition: gsRemapInterface.h:187
T m_equalityTolerance
Tolerance for considering points to be equal.
Definition: gsRemapInterface.h:189
memory::unique_ptr< gsDomainIterator > uPtr
Unique pointer for gsDomainIterator.
Definition: gsDomainIterator.h:73
void addInt(const std::string &label, const std::string &desc, const index_t &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:201
const gsBasis< T > * m_b1
Basis on first patch.
Definition: gsRemapInterface.h:165
bool m_isMatching
True iff the interface is matching.
Definition: gsRemapInterface.h:170
Provides a list of labeled parameters/options that can be set and accessed easily.
T m_newtonTolerance
Tolerance for Newton solver.
Definition: gsRemapInterface.h:190
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
Provides a mapping between the corresponding sides of two patches sharing an interface.
Definition: gsRemapInterface.h:53
T estimateReparamError(index_t steps) const
Estimates error between geometry1 and geometry2 after repearametrization on physical domain...
Definition: gsRemapInterface.hpp:201
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
virtual short_t domainDim() const
Returns parameter dimension of the domains.
Definition: gsRemapInterface.h:125
virtual std::ostream & print(std::ostream &os) const
Prints the state of the object.
Definition: gsRemapInterface.hpp:447
memory::shared_ptr< gsRemapInterface > Ptr
Shared pointer for gsRemapInterface.
Definition: gsRemapInterface.h:58
memory::unique_ptr< gsRemapInterface > uPtr
Unique pointer for gsRemapInterface.
Definition: gsRemapInterface.h:61
bool isAffine() const
Returns true iff the interface is affine.
Definition: gsRemapInterface.h:138
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:211
void constructInterfaceBox()
Computes the box which represents the intersection of sides of incoming patches.
Definition: gsRemapInterface.hpp:140
const gsFunction< T >::Ptr & interfaceMap() const
Returns the interface map iff affine, otherwise the fitting curve.
Definition: gsRemapInterface.h:116
std::vector< std::vector< T > > m_breakpoints
Union of breakpoints of both bases.
Definition: gsRemapInterface.h:173
Instructs constructor always to use an affine mapping.
Definition: gsRemapInterface.h:67
Struct which represents an interface between two patches.
Definition: gsBoundary.h:649
const gsGeometry< T > * m_g1
Geometry of first patch.
Definition: gsRemapInterface.h:162
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
const gsGeometry< T > * m_g2
Geometry of second patch.
Definition: gsRemapInterface.h:163
gsDomainIterator< T >::uPtr makeDomainIterator() const
Returns a domain iterator.
Definition: gsRemapInterface.hpp:434
bool m_isAffine
True iff the interface is affine.
Definition: gsRemapInterface.h:171
gsRemapInterface(const gsMultiPatch< T > &mp, const gsMultiBasis< T > &mb, const boundaryInterface &bi, const gsOptionList &opt=defaultOptions())
Constructor.
Definition: gsRemapInterface.hpp:25
const std::vector< std::vector< T > > & breakPoints() const
Returns the break points used in makeDomainIterator.
Definition: gsRemapInterface.h:141
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
Instructs constructor not to use an affine mapping.
Definition: gsRemapInterface.h:66