GEOS
CompositeFunction.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 Total, S.A
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_COMPOSITEFUNCTION_HPP_
21 #define GEOS_FUNCTIONS_COMPOSITEFUNCTION_HPP_
22 
23 #include "FunctionBase.hpp"
24 
25 #include <mathpresso/mathpresso.h>
26 
27 namespace geos
28 {
29 
36 {
37 public:
39  CompositeFunction( const string & name,
40  dataRepository::Group * const parent );
41 
45  virtual ~CompositeFunction() override;
46 
51  static string catalogName() { return "CompositeFunction"; }
52 
56  virtual void initializeFunction() override;
57 
65  virtual void evaluate( dataRepository::Group const & group,
66  real64 const time,
68  arrayView1d< real64 > const & result ) const override final;
69 
75  virtual real64 evaluate( real64 const * const input ) const override final;
76 
77 private:
78 
79  string_array m_functionNames;
80  string_array m_variableNames;
81  string m_expression;
82 
83  mathpresso::Context parserContext;
84  mathpresso::Expression parserExpression;
85 
86  localIndex m_numSubFunctions;
87  static constexpr localIndex m_maxNumSubFunctions = 10;
88  std::vector< FunctionBase * > m_subFunctions;
89 
90 };
91 
92 } /* namespace geos */
93 
94 #endif /* GEOS_FUNCTIONS_COMPOSITEFUNCTION_HPP_ */
virtual ~CompositeFunction() override
destructor
virtual void initializeFunction() override
Function initialization.
static string catalogName()
Static Factory Catalog Functions.
virtual real64 evaluate(real64 const *const input) const override final
Method to evaluate a function.
CompositeFunction(const string &name, dataRepository::Group *const parent)
Constructor.
virtual 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.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
std::set< T > set
A set of local indices.
Definition: DataTypes.hpp:263
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
Definition: DataTypes.hpp:271