www.mooseframework.org
GriddedData.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef GRIDDEDDATA_H
16 #define GRIDDEDDATA_H
17 
18 #include "libmesh/libmesh_common.h" // Real
19 
20 using namespace libMesh;
21 
22 // C++ includes
23 #include <iosfwd>
24 #include <string>
25 #include <vector>
26 
40 {
41 public:
45  GriddedData(std::string file_name);
46 
47  virtual ~GriddedData() = default;
48 
56  unsigned int getDim();
57 
65  void getAxes(std::vector<int> & axes);
66 
71  void getGrid(std::vector<std::vector<Real>> & grid);
72 
76  void getFcn(std::vector<Real> & fcn);
77 
83  Real evaluateFcn(const std::vector<unsigned int> & ijk);
84 
85 private:
86  unsigned int _dim;
87  std::vector<int> _axes;
88  std::vector<std::vector<Real>> _grid;
89  std::vector<Real> _fcn;
90  std::vector<unsigned int> _step;
91 
92  void parse(unsigned int & dim,
93  std::vector<int> & axes,
94  std::vector<std::vector<Real>> & grid,
95  std::vector<Real> & f,
96  std::vector<unsigned int> & step,
97  std::string file_name);
98  bool getSignificantLine(std::ifstream & file_stream, std::string & line);
99  void splitToRealVec(const std::string & input_string, std::vector<Real> & output_vec);
100 };
101 
102 #endif // GRIDDEDDATA_H
Container for holding a function defined on a grid of arbitrary dimension.
Definition: GriddedData.h:39
std::vector< std::vector< Real > > _grid
Definition: GriddedData.h:88
unsigned int _dim
Definition: GriddedData.h:86
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::vector< unsigned int > _step
Definition: GriddedData.h:90
std::vector< int > _axes
Definition: GriddedData.h:87
std::vector< Real > _fcn
Definition: GriddedData.h:89