Skip to content
Snippets Groups Projects
Commit b7527d95 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Merge branch 'feature/free-boundary-condition' into 'develop'

Feature/free boundary condition

See merge request !46
parents ec8e0e2d 5656c2c6
No related branches found
No related tags found
1 merge request!46Feature/free boundary condition
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <mesh/Mesh.hpp> #include <mesh/Mesh.hpp>
#include <scheme/DirichletBoundaryConditionDescriptor.hpp> #include <scheme/DirichletBoundaryConditionDescriptor.hpp>
#include <scheme/FourierBoundaryConditionDescriptor.hpp> #include <scheme/FourierBoundaryConditionDescriptor.hpp>
#include <scheme/FreeBoundaryConditionDescriptor.hpp>
#include <scheme/IBoundaryConditionDescriptor.hpp> #include <scheme/IBoundaryConditionDescriptor.hpp>
#include <scheme/IBoundaryDescriptor.hpp> #include <scheme/IBoundaryDescriptor.hpp>
#include <scheme/NamedBoundaryDescriptor.hpp> #include <scheme/NamedBoundaryDescriptor.hpp>
......
...@@ -55,8 +55,7 @@ class SubItemValuePerItem ...@@ -55,8 +55,7 @@ class SubItemValuePerItem
public: public:
template <typename IndexType> template <typename IndexType>
PUGS_INLINE const DataType& PUGS_INLINE const DataType& operator[](IndexType i) const noexcept(NO_ASSERT)
operator[](IndexType i) const noexcept(NO_ASSERT)
{ {
static_assert(std::is_integral_v<IndexType>, "SubView is indexed by integral values"); static_assert(std::is_integral_v<IndexType>, "SubView is indexed by integral values");
Assert(i < m_size); Assert(i < m_size);
...@@ -64,8 +63,7 @@ class SubItemValuePerItem ...@@ -64,8 +63,7 @@ class SubItemValuePerItem
} }
template <typename IndexType> template <typename IndexType>
PUGS_FORCEINLINE DataType& PUGS_FORCEINLINE DataType& operator[](IndexType i) noexcept(NO_ASSERT)
operator[](IndexType i) noexcept(NO_ASSERT)
{ {
static_assert(std::is_integral_v<IndexType>, "SubView is indexed by integral values"); static_assert(std::is_integral_v<IndexType>, "SubView is indexed by integral values");
Assert(i < m_size); Assert(i < m_size);
...@@ -104,10 +102,10 @@ class SubItemValuePerItem ...@@ -104,10 +102,10 @@ class SubItemValuePerItem
PUGS_FORCEINLINE DataType& PUGS_FORCEINLINE DataType&
operator()(IndexType item_id, SubIndexType i) const noexcept(NO_ASSERT) operator()(IndexType item_id, SubIndexType i) const noexcept(NO_ASSERT)
{ {
static_assert(std::is_same_v<IndexType, ItemId>, "first index must be an ItemId"); static_assert(std::is_same_v<IndexType, ItemId>, "first index must be of the correct ItemId type");
static_assert(std::is_integral_v<SubIndexType>, "second index must be an integral type"); static_assert(std::is_integral_v<SubIndexType>, "second index must be an integral type");
Assert(this->isBuilt()); Assert(this->isBuilt());
Assert(i < m_host_row_map(size_t{item_id} + 1) - m_host_row_map(size_t{item_id})); Assert(i + m_host_row_map(size_t{item_id}) < m_host_row_map(size_t{item_id} + 1));
return m_values[m_host_row_map(size_t{item_id}) + i]; return m_values[m_host_row_map(size_t{item_id}) + i];
} }
...@@ -122,8 +120,7 @@ class SubItemValuePerItem ...@@ -122,8 +120,7 @@ class SubItemValuePerItem
// Following Kokkos logic, these classes are view and const view does allow // Following Kokkos logic, these classes are view and const view does allow
// changes in data // changes in data
template <typename ArrayIndexType> template <typename ArrayIndexType>
DataType& DataType& operator[](const ArrayIndexType& i) const noexcept(NO_ASSERT)
operator[](const ArrayIndexType& i) const noexcept(NO_ASSERT)
{ {
static_assert(std::is_integral_v<ArrayIndexType>, "index must be an integral type"); static_assert(std::is_integral_v<ArrayIndexType>, "index must be an integral type");
Assert(this->isBuilt()); Assert(this->isBuilt());
......
#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
...@@ -10,6 +10,7 @@ class IBoundaryConditionDescriptor ...@@ -10,6 +10,7 @@ class IBoundaryConditionDescriptor
{ {
dirichlet, dirichlet,
fourier, fourier,
free,
neumann, neumann,
symmetry symmetry
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment