GEOS
MultivariableTableFunction.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_FUNCTIONS_MULTIVARIABLETABLEFUNCTION_HPP_
21 #define GEOS_FUNCTIONS_MULTIVARIABLETABLEFUNCTION_HPP_
22 
23 #include "FunctionBase.hpp"
24 
26 #include "LvArray/src/tensorOps.hpp"
27 
28 namespace geos
29 {
30 
39 {
40 public:
41 
47  MultivariableTableFunction( const string & name,
48  Group * const parent );
49 
54  static string catalogName() { return "MultivariableTableFunction"; }
55 
66  integer const numOps,
67  real64_array const & axisMinimums,
68  real64_array const & axisMaximums,
69  integer_array const & axisPoints );
70 
75  void setTableValues( real64_array const values );
76 
77 
78 
82  virtual void initializeFunction() override;
83 
88  void initializeFunctionFromFile( string const & filename );
89 
90 
98  void evaluate( dataRepository::Group const & group,
99  real64 const time,
101  arrayView1d< real64 > const & result ) const override final
102  {
103  GEOS_UNUSED_VAR( group );
104  GEOS_UNUSED_VAR( time );
105  GEOS_UNUSED_VAR( set );
106  GEOS_UNUSED_VAR( result );
107 
108  GEOS_ERROR( "This method is not supported by MultivariableTableFunction" );
109 
110  };
111 
117  virtual real64 evaluate( real64 const * const input ) const override final
118  {
119  GEOS_UNUSED_VAR( input );
120 
121  GEOS_ERROR( "This method is not supported by MultivariableTableFunction" );
122  return 0;
123  };
124 
129  arrayView1d< real64 const > getAxisMinimums() const { return m_axisMinimums.toViewConst(); }
130 
135  arrayView1d< real64 const > getAxisMaximums() const { return m_axisMaximums.toViewConst(); }
136 
141  arrayView1d< integer const > getAxisPoints() const { return m_axisPoints.toViewConst(); }
142 
143 
148  arrayView1d< real64 const > getAxisSteps() const { return m_axisSteps.toViewConst(); }
149 
154  arrayView1d< real64 const > getAxisStepInvs() const { return m_axisStepInvs.toViewConst(); }
155 
160  arrayView1d< globalIndex const > getAxisHypercubeMults() const { return m_axisHypercubeMults.toViewConst(); }
161 
166  arrayView1d< real64 const > getHypercubeData() const { return m_hypercubeData.toViewConst(); }
167 
172  integer numDims() const {return m_numDims;};
173 
178  integer numOps() const {return m_numOps;};
179 
180 private:
181 
188  void getHypercubePoints( globalIndex const hypercubeIndex, globalIndex_array & hypercubePoints ) const;
189 
191  integer m_numDims;
192 
194  integer m_numOps;
195 
197  integer m_numVerts;
198 
200  real64_array m_axisMinimums;
201 
203  real64_array m_axisMaximums;
204 
206  integer_array m_axisPoints;
207 
208  // inputs : data derived from table coordinates data
209 
211  real64_array m_axisSteps;
212 
214  real64_array m_axisStepInvs;
215 
217  globalIndex_array m_axisPointMults;
218 
220  globalIndex_array m_axisHypercubeMults;
221 
222  // inputs: operator sample data
223 
225  real64_array m_pointData;
226 
228  real64_array m_hypercubeData;
229 };
230 
231 
232 } /* namespace geos */
233 
234 #endif /* GEOS_FUNCTIONS_MULTIVARIABLETABLEFUNCTION_HPP_ */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:84
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
Definition: Logger.hpp:157
void setTableCoordinates(integer const numDims, integer const numOps, real64_array const &axisMinimums, real64_array const &axisMaximums, integer_array const &axisPoints)
Set table coordinates.
void setTableValues(real64_array const values)
Set the table values.
arrayView1d< real64 const > getAxisMinimums() const
Get the table axes minimums.
virtual void initializeFunction() override
Initialize the table function after setting table coordinates and values.
virtual real64 evaluate(real64 const *const input) const override final
Method to evaluate a function (not supported)
arrayView1d< globalIndex const > getAxisHypercubeMults() const
Get the table axes hypercube index multiplicators.
integer numDims() const
Get the number of table dimensions.
arrayView1d< real64 const > getAxisSteps() const
Get the table axes step sizes.
arrayView1d< integer const > getAxisPoints() const
Get the table axes discretization points numbers.
static string catalogName()
The catalog name interface.
void initializeFunctionFromFile(string const &filename)
Initialize the table function using data from file.
arrayView1d< real64 const > getHypercubeData() const
Get the table values stored per-hypercube.
MultivariableTableFunction(const string &name, Group *const parent)
The constructor.
arrayView1d< real64 const > getAxisStepInvs() const
Get the table axes step sizes inversions.
integer numOps() const
Get the number of operators (functions to be interpolated)
void evaluate(dataRepository::Group const &group, real64 const time, SortedArrayView< localIndex const > const &set, arrayView1d< real64 > const &result) const override final
Method to evaluate a function on a target object (not supported)
arrayView1d< real64 const > getAxisMaximums() const
Get the table axes maximums.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:88
array1d< globalIndex > globalIndex_array
A 1-dimensional array of geos::globalIndex types.
Definition: DataTypes.hpp:401
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:383
std::set< T > set
A set of local indices.
Definition: DataTypes.hpp:263
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
array1d< real64 > real64_array
A 1-dimensional array of geos::real64 types.
Definition: DataTypes.hpp:389
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
Definition: DataTypes.hpp:271