Commit c33d3d5e authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#9 - #882 Boundary conditions: introduce sub namespace BoundaryConditionNS within Internal.

parent 530539f4
......@@ -38,7 +38,7 @@ namespace HappyHeart
name_(name),
domain_(domain),
unknown_(unknown),
component_manager_(Internal::ComponentFactory::GetInstance().CreateFromName(component)),
component_manager_(Internal::BoundaryConditionNS::ComponentFactory::GetInstance().CreateFromName(component)),
value_per_component_(value_per_component),
processor_wise_method_(may_overlap ? processor_wise_method::brute_force : processor_wise_method::fast)
# ifndef NDEBUG
......
......@@ -227,7 +227,7 @@ namespace HappyHeart
*
* \return Component manager.
*/
const Internal::ComponentManager& GetComponentManager() const noexcept;
const Internal::BoundaryConditionNS::ComponentManager& GetComponentManager() const noexcept;
/*!
......@@ -285,7 +285,7 @@ namespace HappyHeart
const Unknown& unknown_;
//! Object which can tell which components are encompassed by the boundary condition.
Internal::ComponentManager::const_shared_ptr component_manager_ = nullptr;
Internal::BoundaryConditionNS::ComponentManager::const_shared_ptr component_manager_ = nullptr;
/*!
* \brief Initial values associated to each dof.
......
......@@ -16,7 +16,8 @@ namespace HappyHeart
}
inline const Internal::ComponentManager& DirichletBoundaryCondition::GetComponentManager() const noexcept
inline const Internal::BoundaryConditionNS::ComponentManager& DirichletBoundaryCondition
::GetComponentManager() const noexcept
{
assert(!(!component_manager_));
return *component_manager_;
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp1>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp1>(Create);
} // anonymous namespace
......@@ -50,7 +51,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp1 final : public Internal::TComponentManager<Comp1>
struct Comp1 final : public TComponentManager<Comp1>
{
/*!
......@@ -61,7 +61,7 @@ namespace HappyHeart
};
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp12>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp12>(Create);
} // anonymous namespace
......@@ -49,7 +50,7 @@ namespace HappyHeart
Comp12::Comp12() = default;
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp12 final : public Internal::TComponentManager<Comp12>
struct Comp12 final : public TComponentManager<Comp12>
{
/*!
......@@ -61,7 +61,7 @@ namespace HappyHeart
};
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp123>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp123>(Create);
} // anonymous namespace
......@@ -50,7 +51,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp123 final : public Internal::TComponentManager<Comp123>
struct Comp123 final : public TComponentManager<Comp123>
{
/*!
......@@ -63,7 +63,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp13>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp13>(Create);
} // anonymous namespace
......@@ -50,7 +51,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp13 final : public Internal::TComponentManager<Comp13>
struct Comp13 final : public TComponentManager<Comp13>
{
/*!
......@@ -63,7 +63,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp2>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp2>(Create);
} // anonymous namespace
......@@ -50,7 +51,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp2 final : public Internal::TComponentManager<Comp2>
struct Comp2 final : public TComponentManager<Comp2>
{
/*!
......@@ -63,7 +63,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -22,7 +22,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -40,7 +40,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp23>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp23>(Create);
} // anonymous namespace
......@@ -51,7 +52,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -27,7 +27,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -40,7 +40,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp23 final: public Internal::TComponentManager<Comp23>
struct Comp23 final: public TComponentManager<Comp23>
{
/*!
......@@ -63,7 +63,7 @@ namespace HappyHeart
};
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -39,7 +39,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp3>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<Comp3>(Create);
} // anonymous namespace
......@@ -50,7 +51,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp3 final : public Internal::TComponentManager<Comp3>
struct Comp3 final : public TComponentManager<Comp3>
{
/*!
......@@ -63,7 +63,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -38,7 +38,8 @@ namespace HappyHeart
// Register the geometric element in the 'ComponentFactory' singleton.
// The return value is mandatory: we can't simply call a void function outside function boundaries
// See "Modern C++ Design", Chapter 8, P205.
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<CompNA>(Create);
__attribute__((unused)) const bool registered =
Internal::BoundaryConditionNS::ComponentFactory::CreateOrGetInstance().Register<CompNA>(Create);
} // anonymous namespace
......@@ -49,7 +50,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
......@@ -24,7 +24,7 @@ namespace HappyHeart
{
namespace ComponentNS
namespace BoundaryConditionNS
{
......@@ -37,7 +37,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct CompNA final : public Internal::TComponentManager<CompNA>
struct CompNA final : public TComponentManager<CompNA>
{
/*!
......@@ -60,7 +60,7 @@ namespace HappyHeart
};
} // namespace ComponentNS
} // namespace BoundaryConditionNS
} // namespace Internal
......
//! \file
//! \file
//
//
// ComponentFactory.cpp
......@@ -24,30 +24,35 @@ namespace HappyHeart
{
const std::string& ComponentFactory::ClassName()
namespace BoundaryConditionNS
{
static std::string ret("ComponentFactory");
return ret;
}
ComponentFactory::ComponentFactory() = default;
ComponentManager::const_shared_ptr ComponentFactory::CreateFromName(const std::string& component_name) const
{
auto it = callbacks_.find(component_name);
if (it == callbacks_.cend())
throw ExceptionNS::Factory::UnregisteredName(component_name, "component", __FILE__, __LINE__);
ComponentManager::const_shared_ptr ret = it->second();
const std::string& ComponentFactory::ClassName()
{
static std::string ret("ComponentFactory");
return ret;
}
return ret;
}
ComponentFactory::ComponentFactory() = default;
ComponentManager::const_shared_ptr ComponentFactory::CreateFromName(const std::string& component_name) const
{
auto it = callbacks_.find(component_name);
if (it == callbacks_.cend())
throw ExceptionNS::Factory::UnregisteredName(component_name, "component", __FILE__, __LINE__);
ComponentManager::const_shared_ptr ret = it->second();
return ret;
}
} // namespace BoundaryConditionNS
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment