GridDataOutput.hpp
Go to the documentation of this file.
1/*
2 Copyright 2023 Inria, Bretagne–Atlantique Research Center
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_GRID_DATA_OUTPUT_HPP
21#define OPM_GRID_DATA_OUTPUT_HPP
22
23#include <opm/common/ErrorMacros.hpp>
24
25#include <dune/grid/common/partitionset.hh>
26
27#include <iosfwd>
28#include <string>
29
89{
94
95template <class GridView, unsigned int partitions>
97{
98public:
131 explicit SimMeshDataAccessor(const GridView& gridView,
132 Dune::PartitionSet<partitions> dunePartition);
133
142 bool polyhedralCellPresent() const;
143
151 void countEntities();
152
165 template <typename T>
166 long writeGridPoints(T* x_inout, T* y_inout, T* z_inout, long max_size = 0) const;
167
181 template <typename VectType>
182 long writeGridPoints(VectType& x_inout, VectType& y_inout, VectType& z_inout) const;
183
194 template <typename T>
195 long writeGridPoints_AOS(T* xyz_inout, long max_size = 0) const;
196
206 template <typename VectType>
207 long writeGridPoints_AOS(VectType& xyz_inout) const;
208
219 template <typename T>
220 long writeGridPoints_SOA(T* xyz_inout, long max_size = 0) const;
221
231 template <typename VectType>
232 long writeGridPoints_SOA(VectType& xyz_inout) const;
233
245 template <typename Integer>
246 long writeConnectivity(Integer* connectivity_inout,
247 ConnectivityVertexOrder whichOrder, long max_size = 0) const;
248
261 template <typename VectType>
262 long writeConnectivity(VectType& connectivity_inout,
263 ConnectivityVertexOrder whichOrder) const;
264
276 template <typename Integer>
277 long writeOffsetsCells(Integer* offsets_inout, long max_size = 0) const;
278
289 template <typename VectType>
290 long writeOffsetsCells(VectType& offsets_inout) const;
291
302 template <typename Integer>
303 long writeCellTypes(Integer* types_inout, long max_size = 0) const;
304
313 template <typename VectType>
314 long writeCellTypes(VectType& types_inout) const;
315
316 std::string getPartitionTypeString() const;
317
318 Dune::PartitionSet<partitions> getPartition(void)
319 {
320 return this->dunePartition_;
321 }
322
323 void printGridDetails(std::ostream& outstr) const;
324
325 int getNCells() const
326 {
327 return ncells_;
328 }
329
330 int getNVertices() const
331 {
332 return nvertices_;
333 }
334
335 int getNCorners() const
336 {
337 return ncorners_;
338 }
339
340 std::string getError() const
341 {
342 return error_;
343 }
344
346 {
347 error_.clear();
348 }
349
350 bool hasError() const
351 {
352 return !error_.empty();
353 }
354
355protected:
356 GridView gridView_; // the grid
357
358 Dune::PartitionSet<partitions> dunePartition_;
359 unsigned int partition_value_;
360
373
374 int dimw_; // dimensions of the input grid
375
376private:
377 std::string error_;
378};
379
380} // namespace Opm::GridDataOutput
381
382#endif
Definition: GridDataOutput.hpp:97
Dune::PartitionSet< partitions > getPartition(void)
Definition: GridDataOutput.hpp:318
int ncorners_
Definition: GridDataOutput.hpp:372
long writeGridPoints_AOS(T *xyz_inout, long max_size=0) const
Definition: GridDataOutput_impl.hpp:159
int getNCells() const
Definition: GridDataOutput.hpp:325
int nvertices_
Definition: GridDataOutput.hpp:368
SimMeshDataAccessor(const GridView &gridView, Dune::PartitionSet< partitions > dunePartition)
Construct a SimMeshDataAccessor working on a specific GridView and specialize to a Dune::PartitionSet...
Definition: GridDataOutput_impl.hpp:35
bool hasError() const
Definition: GridDataOutput.hpp:350
void countEntities()
Definition: GridDataOutput_impl.hpp:57
long writeGridPoints(T *x_inout, T *y_inout, T *z_inout, long max_size=0) const
Definition: GridDataOutput_impl.hpp:76
int getNCorners() const
Definition: GridDataOutput.hpp:335
long writeOffsetsCells(Integer *offsets_inout, long max_size=0) const
Definition: GridDataOutput_impl.hpp:396
long writeConnectivity(Integer *connectivity_inout, ConnectivityVertexOrder whichOrder, long max_size=0) const
Definition: GridDataOutput_impl.hpp:311
unsigned int partition_value_
Definition: GridDataOutput.hpp:359
int ncells_
Definition: GridDataOutput.hpp:364
void printGridDetails(std::ostream &outstr) const
Definition: GridDataOutput_impl.hpp:518
bool polyhedralCellPresent() const
Definition: GridDataOutput_impl.hpp:45
long writeCellTypes(Integer *types_inout, long max_size=0) const
Definition: GridDataOutput_impl.hpp:445
int dimw_
Definition: GridDataOutput.hpp:374
long writeGridPoints_SOA(T *xyz_inout, long max_size=0) const
Definition: GridDataOutput_impl.hpp:229
std::string getPartitionTypeString() const
Definition: GridDataOutput_impl.hpp:486
GridView gridView_
Definition: GridDataOutput.hpp:356
Dune::PartitionSet< partitions > dunePartition_
Definition: GridDataOutput.hpp:358
std::string getError() const
Definition: GridDataOutput.hpp:340
void clearError()
Definition: GridDataOutput.hpp:345
int getNVertices() const
Definition: GridDataOutput.hpp:330
Definition: GridDataOutput.hpp:89
ConnectivityVertexOrder
Definition: GridDataOutput.hpp:93
@ VTK
Definition: GridDataOutput.hpp:93
@ DUNE
Definition: GridDataOutput.hpp:93