GEOSX
CompositeFunction.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOSX_MANAGERS_FUNCTIONS_COMPOSITEFUNCTION_HPP_
20 #define GEOSX_MANAGERS_FUNCTIONS_COMPOSITEFUNCTION_HPP_
21 
22 #include "FunctionBase.hpp"
23 
24 #include <mathpresso/mathpresso.h>
25 
26 namespace geosx
27 {
28 
35 {
36 public:
38  CompositeFunction( const std::string & name,
39  dataRepository::Group * const parent );
40 
44  virtual ~CompositeFunction() override;
45 
50  static string CatalogName() { return "CompositeFunction"; }
51 
55  virtual void InitializeFunction() override;
56 
64  virtual void Evaluate( dataRepository::Group const * const group,
65  real64 const time,
67  real64_array & result ) const override final;
68 
74  virtual real64 Evaluate( real64 const * const input ) const override final;
75 
76 private:
77 
78  string_array m_functionNames;
79  string_array m_variableNames;
80  string m_expression;
81 
82  mathpresso::Context parserContext;
83  mathpresso::Expression parserExpression;
84 
85  localIndex m_numSubFunctions;
86  static constexpr localIndex m_maxNumSubFunctions = 10;
87  std::vector< FunctionBase * > m_subFunctions;
88 
89 };
90 
91 } /* namespace geosx */
92 
93 #endif /* GEOSX_MANAGERS_FUNCTIONS_COMPOSITEFUNCTION_HPP_ */
virtual ~CompositeFunction() override
destructor
double real64
64-bit floating point type.
Definition: DataTypes.hpp:136
virtual void Evaluate(dataRepository::Group const *const group, real64 const time, SortedArrayView< localIndex const > const &set, real64_array &result) const override final
Method to evaluate a function on a target object.
static string CatalogName()
Static Factory Catalog Functions.
CompositeFunction(const std::string &name, dataRepository::Group *const parent)
Constructor.
virtual void InitializeFunction() override
Function initialization.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
std::string string
String type.
Definition: DataTypes.hpp:131
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55