From 5656c2c6817043ad0a3d8dd7f72e23bf32377ca7 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Sun, 2 Aug 2020 22:18:12 +0200 Subject: [PATCH] Add free boundary condition descriptor The aim of this kind of boundary condition descriptor is to indicate that as "special" treatment is to be performed for a boundary that is not subject to a boundary condition at the continuous level. For instance it may occur when using a centered scheme to discretize a system which has only one wave (quite often with scalar laws: transport, traffic flow,...) It can be used both to change locally the scheme and to check that no boundary has been forgotten in the description --- src/language/modules/SchemeModule.cpp | 1 + .../FreeBoundaryConditionDescriptor.hpp | 46 +++++++++++++++++++ src/scheme/IBoundaryConditionDescriptor.hpp | 1 + 3 files changed, 48 insertions(+) create mode 100644 src/scheme/FreeBoundaryConditionDescriptor.hpp diff --git a/src/language/modules/SchemeModule.cpp b/src/language/modules/SchemeModule.cpp index a6dcec9c8..542690a4f 100644 --- a/src/language/modules/SchemeModule.cpp +++ b/src/language/modules/SchemeModule.cpp @@ -6,6 +6,7 @@ #include <mesh/Mesh.hpp> #include <scheme/DirichletBoundaryConditionDescriptor.hpp> #include <scheme/FourierBoundaryConditionDescriptor.hpp> +#include <scheme/FreeBoundaryConditionDescriptor.hpp> #include <scheme/IBoundaryConditionDescriptor.hpp> #include <scheme/IBoundaryDescriptor.hpp> #include <scheme/NamedBoundaryDescriptor.hpp> diff --git a/src/scheme/FreeBoundaryConditionDescriptor.hpp b/src/scheme/FreeBoundaryConditionDescriptor.hpp new file mode 100644 index 000000000..b0eb2ceb2 --- /dev/null +++ b/src/scheme/FreeBoundaryConditionDescriptor.hpp @@ -0,0 +1,46 @@ +#ifndef FREE_BOUNDARY_CONDITION_DESCRIPTOR_HPP +#define FREE_BOUNDARY_CONDITION_DESCRIPTOR_HPP + +#include <scheme/IBoundaryConditionDescriptor.hpp> +#include <scheme/IBoundaryDescriptor.hpp> + +#include <memory> + +class FreeBoundaryConditionDescriptor : public IBoundaryConditionDescriptor +{ + private: + std::ostream& + _write(std::ostream& os) const final + { + os << "free(" << *m_boundary_descriptor << ")"; + return os; + } + + std::shared_ptr<const IBoundaryDescriptor> m_boundary_descriptor; + + public: + const IBoundaryDescriptor& + boundaryDescriptor() const + { + return *m_boundary_descriptor; + } + + Type + type() const final + { + return Type::free; + } + + FreeBoundaryConditionDescriptor(std::shared_ptr<const IBoundaryDescriptor> boundary_descriptor) + : m_boundary_descriptor(boundary_descriptor) + { + ; + } + + FreeBoundaryConditionDescriptor(const FreeBoundaryConditionDescriptor&) = delete; + FreeBoundaryConditionDescriptor(FreeBoundaryConditionDescriptor&&) = delete; + + ~FreeBoundaryConditionDescriptor() = default; +}; + +#endif // FREE_BOUNDARY_CONDITION_DESCRIPTOR_HPP diff --git a/src/scheme/IBoundaryConditionDescriptor.hpp b/src/scheme/IBoundaryConditionDescriptor.hpp index be25ba731..30a25db66 100644 --- a/src/scheme/IBoundaryConditionDescriptor.hpp +++ b/src/scheme/IBoundaryConditionDescriptor.hpp @@ -10,6 +10,7 @@ class IBoundaryConditionDescriptor { dirichlet, fourier, + free, neumann, symmetry }; -- GitLab