diff --git a/src/core/math/CMakeLists.txt b/src/core/math/CMakeLists.txt index 69c6e4938d8d0c5cab764e09375a9481559d9caf..5f8733c9ae7fbcf9f8f31a50292e34c9b2c6495f 100644 --- a/src/core/math/CMakeLists.txt +++ b/src/core/math/CMakeLists.txt @@ -40,13 +40,4 @@ target_sources( core Vector2.h Vector3.h extern/exprtk.h - equation_system/Equation.cpp - equation_system/Equation.h - equation_system/FwdEquation.h - equation_system/FwdOperator.h - equation_system/FwdVariable.h - equation_system/Operator.cpp - equation_system/Operator.h - equation_system/Variable.cpp - equation_system/Variable.h ) diff --git a/src/core/math/all.h b/src/core/math/all.h index b79e5ea2dd9e0d6b5f2f3c994166c585ce0dd1bd..a1c1c9e1bc38113246d5a0c11e2a41baad0e2a83 100644 --- a/src/core/math/all.h +++ b/src/core/math/all.h @@ -45,5 +45,3 @@ #include "Utility.h" #include "Vector2.h" #include "Vector3.h" - -#include "equation_system/all.h" diff --git a/src/core/math/equation_system/Equation.cpp b/src/core/math/equation_system/Equation.cpp deleted file mode 100644 index 96717ca97ae89dca49dc9730448a264fd08fc969..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Equation.cpp +++ /dev/null @@ -1,261 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Equation.cpp -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#include "Equation.h" -#include "Operator.h" -#include "Variable.h" - -#include <algorithm> -#include <cmath> -#include <memory> - - -namespace walberla { -namespace math { - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // NODE - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Node::Node( const double value ) : nodeType_(NT_CONSTANT), value_(value ), opType_(OP_NO ) {} - Node::Node( const VarPtr& var ) : nodeType_(NT_VARIABLE), value_(FP_NAN), opType_(OP_NO ), var_(var) {} - Node::Node( OpType& opType ) : nodeType_(NT_OPERATOR), value_(FP_NAN), opType_(opType) {} - - void Node::setVar( const VarPtr& var ){ var_ = var; } - - void Node::collectVariables( VarMap& varMap ){ - switch (nodeType_) - { - case NT_CONSTANT: - break; - case NT_VARIABLE: - if ( varMap.find( var_->getName() ) == varMap.end() ) - varMap[var_->getName()] = var_; - break; - case NT_OPERATOR: - left_->collectVariables ( varMap ); - right_->collectVariables( varMap ); - break; - default: - WALBERLA_ABORT( "No correct node type" ); - break; - } - } - - uint_t Node::countUnknownVariables(){ - switch (nodeType_) - { - case NT_CONSTANT: - return 0; - case NT_VARIABLE: - return var_->valid() ? 0 : 1; - case NT_OPERATOR: - return left_->countUnknownVariables() + right_->countUnknownVariables(); - default: - WALBERLA_ABORT( "No correct node type" ); - return 0; // has no effect - break; - } - } - - double Node::compute(){ - switch (nodeType_) - { - case NT_CONSTANT: - return value_; - case NT_VARIABLE: - return var_->getValue(); - case NT_OPERATOR: - return opType_(left_->compute(), right_->compute()); - default: - WALBERLA_ABORT( "No correct node type" ); - return 0; // has no effect - break; - } - } - - bool Node::findUnknownVariable(){ - switch (nodeType_) - { - case NT_CONSTANT: - return false; - case NT_VARIABLE: - return !var_->valid(); - case NT_OPERATOR: - if(left_->findUnknownVariable()){ - nodeDir_ = ND_LEFT; - return true; - } - if(right_->findUnknownVariable()){ - nodeDir_ = ND_RIGHT; - return true; - } - return false; - default: - WALBERLA_ABORT( "No correct node type" ); - return false; // has no effect - break; - } - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // EQUATION - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Equation::Equation( const NodePtr& root) : root_ (root) - { - root_->collectVariables( varMap_ ); - } - - bool Equation::evaluate(){ - if (!isEvaluatable()) - WALBERLA_ABORT( "Equation is not evaluatable" ); - - double left = root_->left_->compute(); - double right = root_->right_->compute(); - - if ( std::isnan(left) && std::isnan(right) ){ - //WALBERLA_LOG_WARNING( "WARNING: Both values are NAN -> return true" ); - return true; - } else if ( std::isinf(left) && std::isinf(right) ){ - //WALBERLA_LOG_WARNING( "WARNING: Both values are INF -> return true" ); - return true; - } - - const double border = std::max( - std::fabs(left/2e12 + right/2e12), - std::fabs(left/2e12 - right/2e12) ); - - return std::fabs( left - right ) < std::max( border, std::numeric_limits<double>::epsilon() ); - } - - VarPtr Equation::compute(){ - if (!isComputable()) - WALBERLA_ABORT( "Equation is not computable" ); - - sort(); - - root_->left_->var_->setValue( root_->right_->compute() ); - - return root_->left_->var_; - } - - - void Equation::sort(){ - if ( root_->right_->findUnknownVariable() ) - root_->flip(); - else - root_->left_->findUnknownVariable(); - - while( root_->left_->nodeType_ == NT_OPERATOR ){ - if ( root_->left_->opType_ == OP_PLUS ) - { - rotate( (root_->left_->nodeDir_ == ND_RIGHT), OP_MINUS, OP_MINUS ); - } - else if ( root_->left_->opType_ == OP_MINUS ) - { - rotate( false, OP_PLUS, OP_MINUS ); - } - else if ( root_->left_->opType_ == OP_MULT ) - { - rotate( (root_->left_->nodeDir_ == ND_RIGHT), OP_DIV, OP_DIV ); - } - else if ( root_->left_->opType_ == OP_DIV ) - { - rotate( false, OP_MULT, OP_DIV ); - } - else if ( root_->left_->opType_ == OP_PROD ) - { - //rotate( (root_->left_->nodeDir_ == ND_RIGHT), OP_ROOT, OP_LOG ); - rotate( (root_->left_->nodeDir_ == ND_RIGHT), OP_PROD, OP_LOG ); - } - else if ( root_->left_->opType_ == OP_LOG ) - { - //rotate( (root_->left_->nodeDir_ == ND_LEFT), OP_PROD, OP_ROOT ); - rotate( (root_->left_->nodeDir_ == ND_LEFT), OP_PROD, OP_PROD ); - } - //else if ( root_->left_->opType_ == OP_ROOT ) - //{ - // rotate( false, OP_PROD, OP_LOG ); - //} - else - WALBERLA_ABORT( "Unknown operator" ); - } - } - - void Equation::rotate(bool flip, OpType& leftOp, OpType& rightOp){ - NodePtr newNode; - if ( root_->left_->nodeDir_ == ND_LEFT ){ - newNode = std::make_shared<Node>( leftOp ); - if (flip){ - newNode->left_ = root_->left_->right_; - newNode->right_ = root_->right_; - } else { - newNode->right_ = root_->left_->right_; - newNode->left_ = root_->right_; - } - root_->left_ = root_->left_->left_; - } else { - newNode = std::make_shared<Node>( rightOp ); - if (flip){ - newNode->right_ = root_->left_->left_; - newNode->left_ = root_->right_; - } else { - newNode->left_ = root_->left_->left_; - newNode->right_ = root_->right_; - } - root_->left_ = root_->left_->right_; - } - root_->right_ = newNode; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // OUTPUT - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - std::ostream& operator<<( std::ostream& os, const Node & node ){ - switch (node.nodeType_) - { - case NT_CONSTANT: - os << node.value_; - break; - case NT_VARIABLE: - os << node.var_->getName(); - break; - case NT_OPERATOR: - if (node.opType_ == OP_EQUAL) - os << *node.left_ << node.opType_ << *node.right_; - else if( node.opType_ == OP_LOG ) - os << "log(" << *node.left_ << ", " << *node.right_ << ")"; - else - os << "(" << *node.left_ << node.opType_ << *node.right_ << ")"; - break; - default: - WALBERLA_ABORT( "No correct node type" ); - break; - } - return os; - } - - std::ostream& operator<<( std::ostream& os, const Equation & eq ){ - return os << *eq.root_; - } - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/Equation.h b/src/core/math/equation_system/Equation.h deleted file mode 100644 index 3ccbb14f7ef2ca2842222878448e44c10e3e7dfd..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Equation.h +++ /dev/null @@ -1,113 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Equation.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include "FwdEquation.h" -#include "FwdOperator.h" -#include "FwdVariable.h" -#include "core/Abort.h" - - -namespace walberla { -namespace math { - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // NODE - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - class Node - { - friend class Equation; - - private: - const NodeType nodeType_; - const double value_; - NodeDir nodeDir_; - OpType& opType_; - - VarPtr var_; - NodePtr left_; - NodePtr right_; - - public: - Node( const double value ); - Node( const VarPtr& var ); - Node( OpType& opType ); - private: - Node& operator=( const Node& ){ return *this; } - - public: - friend std::ostream& operator<<( std::ostream& os, const Node & node ); - - private: - uint_t countUnknownVariables(); - bool findUnknownVariable(); - - void collectVariables( VarMap& varMap ); - - void flip(){ left_.swap(right_); } - - public: - double compute(); - - NodePtr& left () { return left_; } - NodePtr& right() { return right_; } - - void setVar( const VarPtr& var ); - void setOp ( OpType& opType ); - }; - // end class Node - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // EQUATION - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - class Equation - { - public: - NodePtr root_; - VarMap varMap_; - - public: - Equation( const NodePtr& root ); - - private: - uint_t countUnknownVariables(){ return uint_c( root_->countUnknownVariables() ); } - - public: - friend std::ostream& operator<<( std::ostream& os, const Equation & eq ); - - bool isComputable() { return countUnknownVariables() == 1; } - bool isEvaluatable() { return countUnknownVariables() == 0; } - - bool evaluate(); - VarPtr compute(); - - private: - void sort(); - void rotate(bool flip, OpType& leftOp, OpType& rightOp); - - public: - const VarMap& getVarMap() { return varMap_; } - }; - // end class Equation - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/FwdEquation.h b/src/core/math/equation_system/FwdEquation.h deleted file mode 100644 index 21fbb523cd241c52d51f60fb6fd3f13c0ca136cf..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/FwdEquation.h +++ /dev/null @@ -1,53 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file FwdEquation.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include <memory> - - -namespace walberla { -namespace math { - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // NODE - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - enum NodeType { - NT_OPERATOR, - NT_CONSTANT, - NT_VARIABLE - }; - - enum NodeDir { - ND_LEFT, - ND_RIGHT - }; - - class Node; - using NodePtr = std::shared_ptr<Node>; - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // EQUATION - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - class Equation; - using EquationPtr = std::shared_ptr<Equation>; - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/FwdOperator.h b/src/core/math/equation_system/FwdOperator.h deleted file mode 100644 index 062f371cc3eba90cab5aacb9ccdd92e18b290132..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/FwdOperator.h +++ /dev/null @@ -1,55 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file FwdOperator.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include <map> - - -namespace walberla { -namespace math { - class OpType; - class OpNo; - class OpPlus; - class OpMinus; - class OpMult; - class OpDiv; - class OpProd; - class OpRoot; - class OpLog; - - // no valid operators - extern OpNo OP_NO; - extern OpNo OP_EQUAL; - - // operators - extern OpPlus OP_PLUS; - extern OpMinus OP_MINUS; - extern OpMult OP_MULT; - extern OpDiv OP_DIV; - extern OpProd OP_PROD; - - // functions - extern OpLog OP_LOG; - extern OpRoot OP_ROOT; - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/FwdVariable.h b/src/core/math/equation_system/FwdVariable.h deleted file mode 100644 index bb9e8edf550f014eb01aa904eee6aa1c697c9727..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/FwdVariable.h +++ /dev/null @@ -1,42 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file FwdVariable.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include <memory> -#include <map> -#include <string> - - -namespace walberla { -namespace math { - - extern double NAN_VAL; - - class Var; - - using VarPtr = std::shared_ptr<Var>; - - using VarMap = std::map<std::string, VarPtr>; - using VarMapIt = std::map<std::string, VarPtr>::const_iterator; - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/Operator.cpp b/src/core/math/equation_system/Operator.cpp deleted file mode 100644 index 86c062fc71509325f6520894e98ddd87894bdc44..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Operator.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Operator.cpp -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#include "Operator.h" - - -namespace walberla { -namespace math { - - // no valid operators - OpNo OP_NO ( 'n', "no op", 0u ); - OpNo OP_EQUAL( '=', "equal", 0u ); - - // operators - OpPlus OP_PLUS ( '+', "plus", 10u ); - OpMinus OP_MINUS( '-', "minus", 10u ); - OpMult OP_MULT ( '*', "mult", 30u ); - OpDiv OP_DIV ( '/', "div", 30u ); - OpProd OP_PROD ( '^', "prod", 40u ); - - // functions - OpLog OP_LOG ( '$', "log", 50u ); - //OpRoot OP_ROOT ( '%', "root", 50u ); - - - int isop( const char c ) - { - return - ( OP_PLUS == c || - OP_MINUS == c || - OP_MULT == c || - OP_DIV == c || - OP_PROD == c ) ? c : 0; - } - - OpType& getOp ( const char c ) - { - if (OP_PLUS == c) return OP_PLUS; - if (OP_MINUS == c) return OP_MINUS; - if (OP_MULT == c) return OP_MULT; - if (OP_DIV == c) return OP_DIV; - if (OP_PROD == c) return OP_PROD; - WALBERLA_ABORT( "Found no operator" ); - return OP_NO; // has no effect - } - - std::ostream& operator<<( std::ostream& os, const OpType & type ){ - if( type == '$' ) - return os << type.name_; - return os << type.sign_; - } - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/Operator.h b/src/core/math/equation_system/Operator.h deleted file mode 100644 index e9a6a75e1ed50196b285212e1b5bed3ddfec4649..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Operator.h +++ /dev/null @@ -1,129 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Operator.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include "FwdOperator.h" -#include "core/Abort.h" - -#include <cmath> -#include <string> - - -namespace walberla { -namespace math { - - class OpType - { - private: - const char sign_; - const std::string name_; - const unsigned int strength_; - - public: - OpType( const char& sign, const std::string& n, const unsigned int strength ) : - sign_(sign), name_(n), strength_(strength) {} - - virtual ~OpType() = default; - - private: - OpType& operator=( const OpType& ){ return *this; } - - public: - bool operator==( const OpType & type ) const { return sign_ == type.sign_; } - bool operator==( const char & c ) const { return sign_ == c; } - - bool operator<( const OpType & type ) const { return strength_ < type.strength_; } - bool operator>( const OpType & type ) const { return strength_ > type.strength_; } - bool operator<=( const OpType & type ) const { return strength_ <= type.strength_; } - bool operator>=( const OpType & type ) const { return strength_ >= type.strength_; } - - virtual double operator() ( const double&, const double& ) = 0; - - friend std::ostream& operator<<( std::ostream& os, const OpType & type ); - - public: - const std::string & getName() const { return name_; } - }; - - class OpNo : public OpType{ - public: - OpNo( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double &, const double & ) override { WALBERLA_ABORT( "NO OPERATION" ); return 0; } - }; - - class OpPlus : public OpType{ - public: - OpPlus( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {}; - double operator() ( const double & a, const double & b ) override { return a + b; } - }; - - class OpMinus : public OpType{ - public: - OpMinus( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return a - b; } - }; - - class OpMult : public OpType{ - public: - OpMult( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return a * b; } - }; - - class OpDiv : public OpType{ - public: - OpDiv( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return a / b; } - }; - - class OpProd : public OpType{ - public: - OpProd( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return pow( a, b ); } - }; - - class OpRoot : public OpType{ - public: - OpRoot( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return pow( a, 1/b ); } - }; - - class OpLog : public OpType{ - public: - OpLog( const char& sign, const std::string& name, const unsigned int strength ) : - OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) override { return log10(a) / log10(b); } - }; - - - int isop( const char c ); - - OpType& getOp ( const char c ); - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/Variable.cpp b/src/core/math/equation_system/Variable.cpp deleted file mode 100644 index fcfd72f9a76751a20f57ef6a896a08e00228e85d..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Variable.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Variable.cpp -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#include "Variable.h" - -#include <cmath> -#include <sstream> - - -namespace walberla { -namespace math { - - Var::Var ( const std::string& name ) : - name_ (name), - valid_ (false), - value_ (FP_NAN) - {} - - void Var::setValue( const double value ){ - value_ = value; - valid_ = !std::isnan( value ); - } - - bool Var::operator==( const Var& var) const { - return name_ == var.name_; - } - - std::ostream& operator<<( std::ostream& os, const Var & var ){ - return os << var.name_ << " = " << var.value_; - } - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/Variable.h b/src/core/math/equation_system/Variable.h deleted file mode 100644 index f80f19d5f9723e48d83c7e23d3c00df141d116de..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/Variable.h +++ /dev/null @@ -1,60 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Variable.h -//! \ingroup core -//! \author Matthias Markl <matthias.markl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include "FwdVariable.h" - - -namespace walberla { -namespace math { - - class Var - { - private: - const std::string name_; - - bool valid_; - double value_; - - public: - Var ( const std::string& name ); - private: - Var& operator=( const Var& ){ return *this; } - - public: - bool operator==( const Var& var) const; - - public: - bool valid() const { return valid_; } - double getValue() const { return value_; } - const std::string& getName() const { return name_; } - - public: - void setValue( const double value ); - - public: - friend std::ostream& operator<<( std::ostream& os, const Var & var ); - }; - // end class Var - -} // namespace math -} // namespace walberla diff --git a/src/core/math/equation_system/all.h b/src/core/math/equation_system/all.h deleted file mode 100644 index ed177bebc98597a7d438cc1f2b4e4028cd294c43..0000000000000000000000000000000000000000 --- a/src/core/math/equation_system/all.h +++ /dev/null @@ -1,27 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file all.h -//! \ingroup core -//! \author Florian Schornbaum <florian.schornbaum@fau.de> -//! \brief Collective header file for module core -// -//====================================================================================================================== - -#pragma once - -#include "Equation.h" -#include "Operator.h" -#include "Variable.h"