/* * Box_BoundaryConditions.hpp * * Created on: Jan 2, 2012 * Author: heber */ #ifndef BOX_BOUNDARYCONDITIONS_HPP_ #define BOX_BOUNDARYCONDITIONS_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "LinearAlgebra/defs.hpp" class Box_BoundaryConditionsTest; class BoundaryConditionValidator; namespace BoundaryConditions { //!> typedef for enumeration of boundary conditions typedef enum{ Wrap, Bounce, Ignore, MAX_BoundaryCondition_t } BoundaryCondition_t; //!> typedef for vector containing boundary conditions typedef std::vector Conditions_t; /** This class is a convenience wrapper for the vector of BoundaryCondition_t. * * Here, we place functions for easily printing the boundary conditions, * converting from string to enum, and so on. */ class BCContainer : public Conditions_t { //!> grant unit test access to private members friend class ::Box_BoundaryConditionsTest; friend class ::BoundaryConditionValidator; public: BCContainer(); ~BCContainer(); // getter and setter const Conditions_t & get() const; const BoundaryCondition_t get(size_t index) const; void set(const Conditions_t &_conditions); void set(const std::vector< std::string > &_conditions); void set(size_t index, const BoundaryCondition_t _condition); void set(size_t index, const std::string &_conditions); // converter const std::string & getName(const BoundaryCondition_t &condition) const; const BoundaryCondition_t &getEnum(const std::string &condition) const; private: //!> typedef for the internal enum to string map typedef std::map EnumToStringMap; //!> instance of the enum to string conversion bimap EnumToStringMap ConverterBiMap; //!> typedef for the internal string to enum map typedef std::map StringToEnumMap; //!> instance of the string to enum conversion bimap StringToEnumMap ReConverterBiMap; }; } /* namespace BoundaryConditions */ std::ostream &operator<<(std::ostream &out, const BoundaryConditions::BCContainer &t); std::istream &operator>>(std::istream &in, BoundaryConditions::BCContainer &t); #endif /* BOX_BOUNDARYCONDITIONS_HPP_ */