G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsWriteParaview.h
Go to the documentation of this file.
1 
15 #include <gsCore/gsExport.h>
16 
17 #include <sstream>
18 #include <fstream>
19 
20 #pragma once
21 
22 #define NS 1000
23 
24 
25 namespace gismo {
26 
27 
37 template<class T>
38 void gsWriteParaview(const gsGeometry<T> & Geo, std::string const & fn,
39  unsigned npts=NS, bool mesh = false, bool ctrlNet = false);
40 
49 template<class T>
50 void gsWriteParaview(gsMappedSpline<2,T> const& mspline,
51  std::string const & fn,unsigned npts = NS);
52 
53 
54 
55 
65 template<class T>
66 void gsWriteParaview(gsMultiPatch<T> const& mp, gsMultiBasis<T> const& mb,
67  std::string const & fn, unsigned npts = NS);
68 
80 template<class T>
81 void gsWriteParaview(gsFunctionSet<T> const& geom,
82  gsMappedBasis<2,T> const& mbasis,
83  std::string const & fn,unsigned npts = NS,
84  const bool fullsupport = false,
85  const std::vector<index_t> indices = std::vector<index_t>());
86 
92 //template <class T>
93 //void gsWriteParaview(gsMesh<T> const& sl, std::string const & fn, bool pvd = true);
94 
96 template <class T>
97 void gsWriteParaview(gsMesh<T> const& sl, std::string const & fn, const gsMatrix<T>& params);
98 
99 GISMO_EXPORT void gsWriteParaview(const gsSurfMesh & sm,
100  std::string const & fn,
101  std::initializer_list<std::string> props = {});
102 
107 template <typename T>
108 void gsWriteParaview(const std::vector<gsMesh<T> >& meshes, std::string const& fn);
109 
110 
118 template<class T>
119 void gsWriteParaview(const gsField<T> & field, std::string const & fn,
120  unsigned npts=NS, bool mesh = false, const std::string pDelim = "");
121 
128 template<class T>
129 void gsWriteParaview(gsFunctionSet<T> const& geo, gsFunctionSet<T> const& func,
130  std::string const & fn, unsigned npts = NS, const std::string pDelim = "");
131 
139 template<class T>
140 void gsWriteParaview(const gsMultiPatch<T> & Geo, std::string const & fn,
141  unsigned npts=NS, bool mesh = false, bool ctrlNet = false, const std::string pDelim = "_")
142 {
143  gsWriteParaview( Geo.patches(), fn, npts, mesh, ctrlNet, pDelim);
144 }
145 
153 template<class T>
154 void gsWriteParaview( std::vector<gsGeometry<T> *> const & Geo,
155  std::string const & fn, unsigned npts=NS,
156  bool mesh = false, bool ctrlNet = false, const std::string pDelim = "_");
157 
159 template<class T>
160 void gsWriteParaview(const gsMultiBasis<T> & mb, const gsMultiPatch<T> & domain,
161  std::string const & fn, unsigned npts);
162 
169 template<class T>
170 void gsWriteParaview_basisFnct(int i, gsBasis<T> const& basis,
171  std::string const & fn, unsigned npts =NS);
172 
173 
179 template<class T>
180 void gsWriteParaview(const gsGeometrySlice<T> & Geo,
181  std::string const & fn, unsigned npts =NS);
182 
188 template<class T>
189 void gsWriteParaview(gsFunctionSet<T> const& func,
190  std::string const & fn,
191  unsigned npts =NS);
192 
201 template<class T>
202 void gsWriteParaview(gsFunction<T> const& func,
203  gsMatrix<T> const& supp,
204  std::string const & fn,
205  unsigned npts =NS,
206  bool graph = true);
207 
214 template<class T>
215 void gsWriteParaview(gsBasis<T> const& basis, std::string const & fn,
216  unsigned npts =NS, bool mesh = false);
217 
224 template<class T>
225 void gsWriteParaview(gsHBox<2,T> & box, std::string const & fn);
226 
233 template<class T>
234 void gsWriteParaview(gsHBoxContainer<2,T> & box, std::string const & fn);
235 
236 
242 template<class T>
243 void gsWriteParaviewPoints(gsMatrix<T> const& X,
244  gsMatrix<T> const& Y,
245  std::string const & fn);
246 
253 template<class T>
254 void gsWriteParaviewPoints(gsMatrix<T> const& X,
255  gsMatrix<T> const& Y,
256  gsMatrix<T> const& Z,
257  std::string const & fn);
258 
263 template<class T>
264 void gsWriteParaviewPoints(gsMatrix<T> const& points, std::string const & fn);
265 
272 //template<class T>
273 //void gsWriteParaviewTPgrid(gsMatrix<T> const& points,
274 // gsMatrix<T> const& data,
275 // const gsVector<index_t> & np,
276 // std::string const & fn);
277 
291 template <class T>
292 void gsWriteParaview(gsSolid<T> const& sl, std::string const & fn,
293  unsigned numPoints_for_eachCurve=50, int vol_Num=0,
294  T edgeThick=0.01, gsVector3d<T> const & translate=gsVector3d<T>(0,0,0),
295  int color_convex=0, int color_nonconvex=20, int color_eloop=10,
296  std::vector<unsigned> const & eloop=std::vector<unsigned>());
297 
299 template <class T>
300 void gsWriteParaviewSolid(gsSolid<T> const& sl,
301  std::string const & fn,
302  unsigned numSamples = NS);
303 
309 template<class T>
310 void gsWriteParaview(gsCurveLoop<T> const & cloop, std::string const & fn, unsigned npts)
311 {
312  std::vector<gsGeometry<T> *> all_curves;
313  for(index_t j =0; j< cloop.numCurves() ; j++)
314  all_curves.push_back( const_cast<gsCurve<T> *>(cloop.curve(j)) );
315 
316  gsWriteParaview( all_curves, fn, npts);
317 }
318 
324 template<class T>
325 void gsWriteParaview(gsPlanarDomain<T> const & pdomain,
326  std::string const & fn, unsigned npts=NS);
327 
329 template<class T>
330 void gsWriteParaview(const gsTrimSurface<T> & ts, std::string const & fn,
331  unsigned npts=NS, bool trimCurves = false);
332 
340 template<typename T>
341 void gsWriteParaview(const gsVolumeBlock<T>& volBlock,
342  std::string const & fn,
343  unsigned npts = NS);
344 
353 template<class T>
354 void gsWriteParaviewBdr(gsMultiPatch<T> const & patches,
355  std::string const & fn,
356  unsigned npts, bool ctrlNet);
357 
366 template<class T>
367 void gsWriteParaviewIfc(gsMultiPatch<T> const & patches,
368  std::string const & fn,
369  unsigned npts, bool ctrlNet);
370 
376 template<class T>
377 void gsWriteParaview(gsMultiPatch<T> const & patches,
378  typename gsBoundaryConditions<T>::bcContainer const & bcs,
379  std::string const & fn, unsigned npts=NS, bool ctrlNet=false);
380 
388 template<typename T>
389 void gsWriteParaviewTrimmedCurve(const gsTrimSurface<T>& surf,
390  const unsigned idLoop,
391  const unsigned idCurve,
392  const std::string fn,
393  unsigned npts = NS);
394 
395 // function to plot a field on a single patch
396 template<class T>
397 void writeSinglePatchField(const gsFunction<T> & geometry,
398  const gsFunction<T> & parField,
399  const bool isParam,
400  std::string const & fn, unsigned npts);
401 
403 template<class T>
404 void writeSingleCompMesh(const gsBasis<T> & basis, const gsGeometry<T> & Geo,
405  std::string const & fn, unsigned resolution = 8);
406 
408 template<class T>
409 void writeSingleHBox(gsHBox<2,T> & box, std::string const & fn);
410 
412 template<class T>
413 void writeSingleControlNet(const gsGeometry<T> & Geo,
414  std::string const & fn);
415 
416 // Please document
417 template <class T>
418 void plot_errors(const gsMatrix<T> & orig,
419  const gsMatrix<T> & comp,
420  std::vector<T> const & errors,
421  std::string const & fn);
422 
423 
424 #ifdef GISMO_WITH_PYBIND11
425 
429  void pybind11_init_gsWriteParaview(pybind11::module &m);
430 
431 #endif // GISMO_WITH_PYBIND11
432 
433 
434 } // namespace gismo
435 
436 
437 
438 #undef NS
439 
440 
441 #ifndef GISMO_BUILD_LIB
442 #include GISMO_HPP_HEADER(gsWriteParaview.hpp)
443 #endif
void gsWriteParaview_basisFnct(int i, gsBasis< T > const &basis, std::string const &fn, unsigned npts=NS)
Export i-th Basis function to paraview file.
Definition: gsWriteParaview.hpp:984
Abstract base class representing a curve.
Definition: gsCurve.h:30
int numCurves() const
get Number of curves
Definition: gsCurveLoop.h:172
void gsWriteParaviewIfc(gsMultiPatch< T > const &patches, std::string const &fn, unsigned npts, bool ctrlNet)
Writes the interfaces of a multipatch to paraview.
Definition: gsWriteParaview.hpp:1967
#define index_t
Definition: gsConfig.h:32
void gsWriteParaviewPoints(gsMatrix< T > const &X, gsMatrix< T > const &Y, std::string const &fn)
Export 2D Point set to Paraview file.
Definition: gsWriteParaview.hpp:1267
Handles shared library creation and other class attributes.
void gsWriteParaviewTrimmedCurve(const gsTrimSurface< T > &surf, const unsigned idLoop, const unsigned idCurve, const std::string fn, unsigned npts=NS)
Export a boundary/hole curve in trimmed surface.
Definition: gsWriteParaview.hpp:1992
void gsWriteParaviewSolid(gsSolid< T > const &sl, std::string const &fn, unsigned numSamples=NS)
Export a gsSolid to Paraview file.
Definition: gsWriteParaview.hpp:1665
Provides forward declarations of types and structs.
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
void writeSingleCompMesh(const gsBasis< T > &basis, const gsGeometry< T > &Geo, std::string const &fn, unsigned resolution=8)
Export a computational mesh.
Definition: gsWriteParaview.hpp:232
void gsWriteParaviewBdr(gsMultiPatch< T > const &patches, std::string const &fn, unsigned npts, bool ctrlNet)
Writes the boundaries of a multipatch to paraview.
Definition: gsWriteParaview.hpp:1954
void writeSingleHBox(gsHBox< 2, T > &box, std::string const &fn)
Export a gsHBox.
Definition: gsWriteParaview.hpp:1180
A closed loop given by a collection of curves.
Definition: gsCurveLoop.h:36
PatchContainer const & patches() const
Returns a vector of patches // to do : replace by copies.
Definition: gsMultiPatch.h:211
void writeSingleControlNet(const gsGeometry< T > &Geo, std::string const &fn)
Export a control net.
Definition: gsWriteParaview.hpp:248