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