G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsApproxC1Edge.h
Go to the documentation of this file.
1 
14 #pragma once
15 
18 
19 #include <gsUnstructuredSplines/src/gsApproxC1GluingData.h>
20 
22 
23 namespace gismo
24 {
25 
26 
27 template<short_t d, class T>
28 class gsApproxC1Edge
29 {
30 
31 private:
32  typedef gsContainerBasis<d, T> Basis;
33  typedef typename std::vector<Basis> BasisContainer;
34  typedef typename std::vector<gsPatchReparameterized<d,T>> C1AuxPatchContainer;
35 
37  typedef memory::shared_ptr<gsApproxC1Edge> Ptr;
38 
40  typedef memory::unique_ptr<gsApproxC1Edge> uPtr;
41 
42 
43 public:
45  ~gsApproxC1Edge() { }
46 
47 
48  gsApproxC1Edge(gsMultiPatch<T> const & mp,
49  BasisContainer & bases,
50  const boundaryInterface & item,
51  size_t & numInt,
52  const gsOptionList & optionList)
53  : m_mp(mp), m_bases(bases), m_optionList(optionList)
54  {
55  m_auxPatches.clear();
56  m_auxPatches.push_back(gsPatchReparameterized<d,T>(m_mp.patch(item.first().patch), m_bases[item.first().patch]));
57  m_auxPatches.push_back(gsPatchReparameterized<d,T>(m_mp.patch(item.second().patch), m_bases[item.second().patch]));
58 
59  std::vector<patchSide> sidesContainer(2);
60  sidesContainer[0] = item.first();
61  sidesContainer[1] = item.second();
62 
63  reparametrizeInterfacePatches(sidesContainer);
64 
65  compute(sidesContainer);
66 /*
67  if (m_optionList.getSwitch("plot"))
68  {
69  std::string fileName;
70  std::string basename = "InterfaceBasisFunctions" + util::to_string(numInt);
71  gsParaviewCollection collection(basename);
72 
73  for (size_t i = 0; i< basisEdgeResult[0].nPatches(); i++)
74  {
75  // First Interface Side
76  fileName = basename + "_0_" + util::to_string(i);
77  gsField<T> temp_field(m_mp.patch(item.first().patch), basisEdgeResult[0].patch(i));
78  gsWriteParaview(temp_field, fileName, 5000);
79  collection.addTimestep(fileName, i, "0.vts");
80  // Second Interface Side
81  fileName = basename + "_1_" + util::to_string(i);
82  gsField<T> temp_field_1(m_mp.patch(item.second().patch), basisEdgeResult[1].patch(i));
83  gsWriteParaview(temp_field_1, fileName, 5000);
84  collection.addTimestep(fileName, i, "0.vts");
85  }
86  collection.save();
87 
88  //gsWriteParaview(basisEdgeResult[0], "interface_basis", 20000);
89  }
90 */
91  }
92 
93  gsApproxC1Edge(gsMultiPatch<T> const & mp,
94  BasisContainer & bases,
95  const patchSide & item,
96  size_t & numBdy,
97  const gsOptionList & optionList)
98  : m_mp(mp), m_bases(bases), m_optionList(optionList)
99  {
100  m_auxPatches.clear();
101  m_auxPatches.push_back(gsPatchReparameterized<d,T>(m_mp.patch(item.patch), m_bases[item.patch]));
102 
103  std::vector<patchSide> sidesContainer(1);
104  sidesContainer[0] = item;
105 
106  reparametrizeSinglePatch(item.side().index());
107 
108  compute(sidesContainer);
109 /*
110  if (m_optionList.getSwitch("plot")) {
111  std::string fileName;
112  std::string basename = "BoundaryBasisFunctions" + util::to_string(numBdy);
113  gsParaviewCollection collection(basename);
114 
115  for (size_t i = 0; i < basisEdgeResult[0].nPatches(); i++) {
116  // First Interface Side
117  fileName = basename + "_0_" + util::to_string(i);
118  gsField<T> temp_field(m_mp.patch(item.patch), basisEdgeResult[0].patch(i));
119  gsWriteParaview(temp_field, fileName, 5000);
120  collection.newTimeStep(fileName, i, "0.vts");
121  }
122  collection.save();
123  }
124 */
125  }
126 
127  std::vector<gsMultiPatch<T>> getEdgeBasis() { return basisEdgeResult; };
128 
129 protected:
130 
131  // Input
132  gsMultiPatch<T> const & m_mp;
133  BasisContainer & m_bases;
134 
135  const gsOptionList & m_optionList;
136 
137  // Need for rotation, etc.
138  C1AuxPatchContainer m_auxPatches;
139 
140  // Store temp solution
141  std::vector<gsMultiPatch<T>> basisEdgeResult;
142 
143 private:
144 
145  // Compute topology
146  // After computeTopology() the patches will have the same patch-index as the position-index in auxGeom
147  // EXAMPLE: global patch-index-order inside auxGeom: [2, 3, 4, 1, 0]
148  // in auxTop: 2->0, 3->1, 4->2, 1->3, 0->4
149  void computeAuxTopology();
150 
151  void reparametrizeInterfacePatches(std::vector<patchSide> & sidesContainer);
152 
153  void reparametrizeSinglePatch(index_t side);
154 
155  void compute(std::vector<patchSide> & sidesContainer);
156 
157 }; // Class gsApproxC1Edge
158 
159 } // namespace gismo
160 
161 #ifndef GISMO_BUILD_LIB
162 #include GISMO_HPP_HEADER(gsApproxC1Edge.hpp)
163 #endif
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
Provides declaration of Basis abstract interface.
#define index_t
Definition: gsConfig.h:32
Reparametrize one Patch.
Provides declaration of Basis abstract interface. Similar to gsMultiBasis, but without topology...
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
patchSide & second()
second, returns the second patchSide of this interface
Definition: gsBoundary.h:782
Struct which represents an interface between two patches.
Definition: gsBoundary.h:649
short_t index() const
Returns the index (as specified in boundary::side) of the box side.
Definition: gsBoundary.h:140
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
index_t patch
The index of the patch.
Definition: gsBoundary.h:234
patchSide & first()
first, returns the first patchSide of this interface
Definition: gsBoundary.h:776