Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 530539f4 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#9 BoundaryCondition: move ComponentManager into Private namespace.

parent ba2528f3
This diff is collapsed.
//! \file
//
//
// Component.cpp
// HappyHeart
//
// Created by Sébastien Gilles on 08/10/13.
// Copyright (c) 2013 Inria. All rights reserved.
//
#include <sstream>
#include "Utilities/Containers/Print.hpp"
#include "FiniteElement/BoundaryConditions/ComponentManager.hpp"
namespace HappyHeart
{
ComponentManager::ComponentManager(const std::string& name, std::bitset<3> is_activated)
: name_(name),
is_activated_(is_activated)
{ }
std::string ComponentManager::AsString() const
{
if (!is_activated_.any())
return "NA";
std::vector<char> buf;
if (IsActive(0))
buf.push_back('x');
if (IsActive(1))
buf.push_back('y');
if (IsActive(2))
buf.push_back('z');
std::ostringstream oconv;
Utilities::PrintContainer(buf, oconv, ", ", "", "");
return oconv.str();
}
unsigned int ComponentManager::ActiveComponent(unsigned int i) const
{
unsigned int ret = 0;
assert(i < is_activated_.count());
for (unsigned int Nactive_read = 0 ; Nactive_read < i + 1; ++ret)
{
if (IsActive(ret))
++Nactive_read;
}
return ret - 1;
}
} // namespace HappyHeart
//! \file
//
//
// triangle6.h
// Refactoring
//
// Created by Sebastien Gilles on 12/12/12.
// Copyright 2012 INRIA. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HPP_
# include <string>
# include <bitset>
# include <cassert>
# include <memory>
namespace HappyHeart
{
/// \addtogroup FElt
///@{
/*!
* \brief Helper class to handle which components are to be used in an essential boundary condition.
*
* This allows in particular to for instance consider only the second component of a vectorial unknown.
*
* \internal <b><tt>[internal]</tt></b> Management of components should probably be overhauled completely
* at some point; current class is still heavily inspired by Felisce interface. However so far it worked
* for all the cases we considered and so it's quite low in our current todo list.
*/
class ComponentManager
{
public:
//! Shared smart pointer.
using const_shared_ptr = std::shared_ptr<const ComponentManager>;
//! Constructor.
explicit ComponentManager(const std::string& name, std::bitset<3> is_activated);
//! Destructor
~ComponentManager() = default;
//! Copy constructor.
ComponentManager(const ComponentManager&) = delete;
//! Move constructor.
ComponentManager(ComponentManager&&) = delete;
//! Copy affectation.
ComponentManager& operator=(const ComponentManager&) = delete;
//! Move affectation.
ComponentManager& operator=(ComponentManager&&) = delete;
//! Returns the name of the component.
const std::string& Name() const;
//! Returns whether the \a i -th component is active.
bool IsActive(unsigned int i) const;
//! Returns the number of active components.
unsigned int Nactive() const;
//! Return as a string the components available, separated by a comma (e.g. "x, y").
std::string AsString() const;
/*!
* \brief Return the position of the \a i -th active component in the bitset (in C numbering).
*
*
* For instance, if bitset = 101 (and remember bitsets are read from the right to the left!):
* \code
* ActiveComponent(0); // yields 0
* ActiveComponent(1); // yields 2
* ActiveComponent(2); // ERROR!
* \endcode
*
* \param[in] i Index of the active component to consider; should be in [0, Nactive_component[.
*
* \return Which is the \a i -th active component.
*/
unsigned int ActiveComponent(unsigned int i) const;
private:
//! Name of the component, e.g. "Comp12".
std::string name_;
/*!
* \brief Which component are activated.
*
* BEWARE: a bitset is read from the right to the left... So "100" means z component is active, not x one.
*/
std::bitset<3> is_activated_;
};
///@} // \addtogroup
} // namespace HappyHeart
# include "FiniteElement/BoundaryConditions/ComponentManager.hxx"
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HPP_
//! \file
//
//
// triangle6.h
// Refactoring
//
// Created by Sebastien Gilles on 12/12/12.
// Copyright 2012 INRIA. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HXX_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HXX_
namespace HappyHeart
{
inline const std::string& ComponentManager::Name() const
{
return name_;
}
inline bool ComponentManager::IsActive(unsigned int i) const
{
assert(i < is_activated_.size());
return is_activated_[i];
}
inline unsigned int ComponentManager::Nactive() const
{
return static_cast<unsigned int>(is_activated_.count());
}
} // namespace HappyHeart
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_MANAGER_HXX_
......@@ -11,7 +11,7 @@
#include "Geometry/Domain.hpp"
#include "FiniteElement/BoundaryConditions/DirichletBoundaryCondition.hpp"
#include "FiniteElement/BoundaryConditions/Private/ComponentFactory.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComponentFactory.hpp"
#include "FiniteElement/FiniteElementSpace/GodOfDof.hpp"
......@@ -38,7 +38,7 @@ namespace HappyHeart
name_(name),
domain_(domain),
unknown_(unknown),
component_manager_(Private::ComponentFactory::GetInstance().CreateFromName(component)),
component_manager_(Internal::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
......
......@@ -16,8 +16,8 @@
# include "Geometry/MeshLabel.hpp"
# include "FiniteElement/Unknown/Unknown.hpp"
# include "FiniteElement/BoundaryConditions/ComponentManager.hpp"
# include "FiniteElement/Nodes_and_dofs/NodeBearer.hpp"
# include "FiniteElement/BoundaryConditions/Internal/ComponentManager.hpp"
# include "FiniteElement/BoundaryConditions/Private/BoundaryConditionDofStorage.hpp"
......@@ -227,9 +227,9 @@ namespace HappyHeart
*
* \return Component manager.
*/
const ComponentManager& GetComponentManager() const noexcept;
const Internal::ComponentManager& GetComponentManager() const noexcept;
/*!
* \brief Return the value of the requested boundary condition.
*
......@@ -285,7 +285,7 @@ namespace HappyHeart
const Unknown& unknown_;
//! Object which can tell which components are encompassed by the boundary condition.
ComponentManager::const_shared_ptr component_manager_ = nullptr;
Internal::ComponentManager::const_shared_ptr component_manager_ = nullptr;
/*!
* \brief Initial values associated to each dof.
......
......@@ -16,7 +16,7 @@ namespace HappyHeart
}
inline const ComponentManager& DirichletBoundaryCondition::GetComponentManager() const noexcept
inline const Internal::ComponentManager& DirichletBoundaryCondition::GetComponentManager() const noexcept
{
assert(!(!component_manager_));
return *component_manager_;
......
......@@ -9,15 +9,15 @@
//
#include "FiniteElement/BoundaryConditions/Private/Component/Comp1.hpp"
#include "FiniteElement/BoundaryConditions/Private/ComponentFactory.hpp"
#include "FiniteElement/BoundaryConditions/Internal/Component/Comp1.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComponentFactory.hpp"
namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -39,7 +39,7 @@ 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 = Private::ComponentFactory::CreateOrGetInstance().Register<Comp1>(Create);
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp1>(Create);
} // anonymous namespace
......@@ -53,8 +53,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
} // namespace HappyHeart
......@@ -8,12 +8,12 @@
// Copyright (c) 2013 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP1_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP1_HPP_
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP1_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP1_HPP_
# include <bitset>
# include "FiniteElement/BoundaryConditions/Private/TComponentManager.hpp"
# include "FiniteElement/BoundaryConditions/Internal/TComponentManager.hpp"
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp1 final : public Private::TComponentManager<Comp1>
struct Comp1 final : public Internal::TComponentManager<Comp1>
{
/*!
......@@ -64,10 +64,10 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
} // namespace HappyHeart
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP1_HPP_
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP1_HPP_
......@@ -9,15 +9,15 @@
//
#include "FiniteElement/BoundaryConditions/Private/Component/Comp12.hpp"
#include "FiniteElement/BoundaryConditions/Private/ComponentFactory.hpp"
#include "FiniteElement/BoundaryConditions/Internal/Component/Comp12.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComponentFactory.hpp"
namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -39,7 +39,7 @@ 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 = Private::ComponentFactory::CreateOrGetInstance().Register<Comp12>(Create);
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp12>(Create);
} // anonymous namespace
......@@ -52,7 +52,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
......
......@@ -8,12 +8,12 @@
// Copyright (c) 2013 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP12_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP12_HPP_
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP12_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP12_HPP_
# include <bitset>
# include "FiniteElement/BoundaryConditions/Private/TComponentManager.hpp"
# include "FiniteElement/BoundaryConditions/Internal/TComponentManager.hpp"
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp12 final : public Private::TComponentManager<Comp12>
struct Comp12 final : public Internal::TComponentManager<Comp12>
{
/*!
......@@ -64,7 +64,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
......@@ -72,4 +72,4 @@ namespace HappyHeart
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP12_HPP_
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP12_HPP_
......@@ -9,15 +9,15 @@
//
#include "FiniteElement/BoundaryConditions/Private/Component/Comp123.hpp"
#include "FiniteElement/BoundaryConditions/Private/ComponentFactory.hpp"
#include "FiniteElement/BoundaryConditions/Internal/Component/Comp123.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComponentFactory.hpp"
namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -39,7 +39,7 @@ 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 = Private::ComponentFactory::CreateOrGetInstance().Register<Comp123>(Create);
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp123>(Create);
} // anonymous namespace
......@@ -53,7 +53,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
......
......@@ -8,12 +8,12 @@
// Copyright (c) 2013 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP123_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP123_HPP_
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP123_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP123_HPP_
# include <bitset>
# include "FiniteElement/BoundaryConditions/Private/TComponentManager.hpp"
# include "FiniteElement/BoundaryConditions/Internal/TComponentManager.hpp"
......@@ -21,7 +21,7 @@ namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -38,7 +38,7 @@ namespace HappyHeart
* the derived classes are designed to be very lightweight and add no additional functionalities...)
*
*/
struct Comp123 final : public Private::TComponentManager<Comp123>
struct Comp123 final : public Internal::TComponentManager<Comp123>
{
/*!
......@@ -66,7 +66,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
......@@ -74,4 +74,4 @@ namespace HappyHeart
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP123_HPP_
#endif // HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP123_HPP_
......@@ -9,15 +9,15 @@
//
#include "FiniteElement/BoundaryConditions/Private/Component/Comp13.hpp"
#include "FiniteElement/BoundaryConditions/Private/ComponentFactory.hpp"
#include "FiniteElement/BoundaryConditions/Internal/Component/Comp13.hpp"
#include "FiniteElement/BoundaryConditions/Internal/ComponentFactory.hpp"
namespace HappyHeart
{
namespace Private
namespace Internal
{
......@@ -39,7 +39,7 @@ 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 = Private::ComponentFactory::CreateOrGetInstance().Register<Comp13>(Create);
__attribute__((unused)) const bool registered = Internal::ComponentFactory::CreateOrGetInstance().Register<Comp13>(Create);
} // anonymous namespace
......@@ -53,7 +53,7 @@ namespace HappyHeart
} // namespace ComponentNS
} // namespace Private
} // namespace Internal
......
......@@ -8,12 +8,12 @@
// Copyright (c) 2013 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP13_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_COMPONENT_x_COMP13_HPP_
#ifndef HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP13_HPP_
# define HAPPY_HEART_x_FINITE_ELEMENT_x_BOUNDARY_CONDITIONS_x_INTERNAL_x_COMPONENT_x_COMP13_HPP_
# include <bitset>
# include "FiniteElement/BoundaryConditions/Private/TComponentManager.hpp"
# include "FiniteElement/BoundaryConditions/Internal/TComponentManager.hpp"