Commit fd32d061 authored by DIAZ Jerome's avatar DIAZ Jerome Committed by GILLES Sebastien

#1520 Added a ParameterOperator which converts the local coordinates of...

#1520 Added a ParameterOperator which converts the local coordinates of quadrature points of a given quadrature rule to global coordinates. This operator stores the result as a vectorial ParameterAtQuadraturePoint.
parent 5342d900
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
# include "OperatorInstances/ParameterOperator/GlobalCoordsQuadPoints.hpp"
namespace MoReFEM
{
namespace GlobalParameterOperatorNS
{
GlobalCoordsQuadPoints
::GlobalCoordsQuadPoints(const FEltSpace& felt_space,
const Unknown& unknown,
const QuadratureRulePerTopology* const quadrature_rule_per_topology,
ParameterAtQuadraturePoint
<
ParameterNS::Type::vector,
ParameterNS::TimeDependencyNS::None
>& global_coords_quad_pt)
: parent(felt_space,
unknown,
quadrature_rule_per_topology,
AllocateGradientFEltPhi::yes,
global_coords_quad_pt)
{
decltype(auto) extended_unknown_ptr = felt_space.GetExtendedUnknownPtr(unknown);
felt_space.ComputeLocal2Global(std::move(extended_unknown_ptr),
DoComputeProcessorWiseLocal2Global::yes);
}
const std::string& GlobalCoordsQuadPoints::ClassName()
{
static std::string name("GlobalCoordsQuadPoints");
return name;
}
} // namespace GlobalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
#ifndef MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HPP_
# define MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HPP_
# include "Parameters/Parameter.hpp"
# include "Parameters/InitParameterFromInputData/InitParameterFromInputData.hpp"
# include "Operators/GlobalVariationalOperator/ExtractLocalDofValues.hpp"
# include "Operators/ParameterOperator/GlobalParameterOperator/GlobalParameterOperator.hpp"
# include "OperatorInstances/ParameterOperator/Local/GlobalCoordsQuadPoints.hpp"
namespace MoReFEM
{
namespace GlobalParameterOperatorNS
{
/*!
* \brief Implementation of global \a GlobalCoordsQuadPoints operator.
* Given a quadrature rule, this operator computes the global coordinates of the quadrature points used by this
* rule on the relevant finite element space and stores them into a ParameterAtQuadraturePoint attribute.
*/
class GlobalCoordsQuadPoints final
: public GlobalParameterOperator
<
GlobalCoordsQuadPoints,
LocalParameterOperatorNS::GlobalCoordsQuadPoints,
ParameterNS::Type::vector
>
{
public:
//! Alias to unique pointer.
using const_unique_ptr = std::unique_ptr<const GlobalCoordsQuadPoints>;
//! Returns the name of the operator.
static const std::string& ClassName();
//! Convenient alias to pinpoint the GlobalParameterOperator parent.
using parent = GlobalParameterOperator
<
GlobalCoordsQuadPoints,
LocalParameterOperatorNS::GlobalCoordsQuadPoints,
ParameterNS::Type::vector
>;
//! Friendship to the parent class so that the CRTP can reach private methods defined below.
friend parent;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
* \param[in] felt_space Finite element space upon which the operator is defined.
* \param[in] unknown Unknown considered for this operator (might be vector or vectorial).
* \param[in] quadrature_rule_per_topology Quadrature rule from which the global coordinates of the quadrature points
* will be computed.
*/
explicit GlobalCoordsQuadPoints(const FEltSpace& felt_space,
const Unknown& unknown,
const QuadratureRulePerTopology* const quadrature_rule_per_topology,
ParameterAtQuadraturePoint
<
ParameterNS::Type::vector,
ParameterNS::TimeDependencyNS::None
>& global_coords_quad_pt);
//! Destructor.
~GlobalCoordsQuadPoints() = default;
//! \copydoc doxygen_hide_copy_constructor
GlobalCoordsQuadPoints(const GlobalCoordsQuadPoints& rhs) = delete;
//! \copydoc doxygen_hide_move_constructor
GlobalCoordsQuadPoints(GlobalCoordsQuadPoints&& rhs) = delete;
//! \copydoc doxygen_hide_copy_affectation
GlobalCoordsQuadPoints& operator=(const GlobalCoordsQuadPoints& rhs) = delete;
//! \copydoc doxygen_hide_move_affectation
GlobalCoordsQuadPoints& operator=(GlobalCoordsQuadPoints&& rhs) = delete;
///@}
/*!
* \brief To get the local operator to convert local quadrature point coordinates into global ones.
*/
void Update() const;
public:
/*!
* \brief Only defined to respect the generic interface expected by the parent, it is not used as there is
* no extraction of data from a global to a local level needed for this class.
*
* \param[in] local_operator Local operator in charge of the elementary computation. A mutable work
* variable is actually set in this call.
* \param[in] local_felt_space List of finite elements being considered; all those related to the
* same GeometricElt.
*
*/
void
SetComputeEltArrayArguments(const LocalFEltSpace& local_felt_space,
LocalParameterOperator& local_operator,
const std::tuple<>&& ) const;
};
} // namespace GlobalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
# include "OperatorInstances/ParameterOperator//GlobalCoordsQuadPoints.hxx"
#endif // MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HPP_
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
#ifndef MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HXX_
# define MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HXX_
namespace MoReFEM
{
namespace GlobalParameterOperatorNS
{
inline void GlobalCoordsQuadPoints::Update() const
{
return parent::UpdateImpl();
}
inline void GlobalCoordsQuadPoints
::SetComputeEltArrayArguments(const LocalFEltSpace& local_felt_space,
LocalParameterOperator& local_operator,
const std::tuple<>&& ) const
{
static_cast<void>(local_felt_space);
static_cast<void>(local_operator);
}
} // namespace GlobalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
#endif // MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_WRITE_AT_QUAD_POINT_HXX_
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
#include "Operators/LocalVariationalOperator/Advanced/GradientDisplacementMatrix.hpp"
#include "OperatorInstances/ParameterOperator/Local/GlobalCoordsQuadPoints.hpp"
namespace MoReFEM
{
namespace LocalParameterOperatorNS
{
GlobalCoordsQuadPoints
::GlobalCoordsQuadPoints(const ExtendedUnknown::const_shared_ptr& a_unknown_storage,
elementary_data_type&& a_elementary_data,
ParameterAtQuadraturePoint
<
ParameterNS::Type::vector,
ParameterNS::TimeDependencyNS::None
>& global_coords_quad_pt)
: parent(a_unknown_storage, std::move(a_elementary_data), global_coords_quad_pt)
{
}
GlobalCoordsQuadPoints::~GlobalCoordsQuadPoints() = default;
const std::string& GlobalCoordsQuadPoints::ClassName()
{
static std::string name("GlobalCoordsQuadPoints");
return name;
}
void GlobalCoordsQuadPoints::ComputeEltArray()
{
auto& elementary_data = GetNonCstElementaryData();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
const auto& geom_elt = elementary_data.GetCurrentGeomElt();
SpatialPoint global_quad_pt_coords_as_spatial_point;
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
auto functor = [&geom_elt, &quad_pt, &global_quad_pt_coords_as_spatial_point](LocalVector& global_quad_pt_coords)
{
assert(global_quad_pt_coords.size() == global_quad_pt_coords_as_spatial_point.GetCoordinateList().size());
Advanced::GeomEltNS::Local2Global(geom_elt, quad_pt, global_quad_pt_coords_as_spatial_point);
global_quad_pt_coords(0) = global_quad_pt_coords_as_spatial_point.x();
global_quad_pt_coords(1) = global_quad_pt_coords_as_spatial_point.y();
global_quad_pt_coords(2) = global_quad_pt_coords_as_spatial_point.z();
};
GetNonCstParameter().UpdateValue(quad_pt,
geom_elt,
functor);
}
}
} // namespace LocalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
#ifndef MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HPP_
# define MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HPP_
# include "Utilities/LinearAlgebra/Storage/Local/LocalMatrixStorage.hpp"
# include "Utilities/LinearAlgebra/Storage/Local/LocalVectorStorage.hpp"
# include "Geometry/GeometricElt/Advanced/FreeFunctions.hpp"
# include "Parameters/Parameter.hpp"
# include "Operators/ParameterOperator/LocalParameterOperator/LocalParameterOperator.hpp"
namespace MoReFEM
{
namespace LocalParameterOperatorNS
{
/*!
* \brief Implementation of local \a GlobalCoordsQuadPoints operator.
* This local operator is in charge of computing the global coordinates of each quadrature point.
*/
class GlobalCoordsQuadPoints final
: public Advanced::LocalParameterOperator<ParameterNS::Type::vector>
{
public:
//! \copydoc doxygen_hide_alias_self
using self = GlobalCoordsQuadPoints;
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<self>;
//! Returns the name of the operator.
static const std::string& ClassName();
//! Alias to parent.
using parent = Advanced::LocalParameterOperator<ParameterNS::Type::vector>;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
* \param[in] unknown_list List of unknowns considered by the operators. Its type (vector_shared_ptr)
* is due to constraints from genericity.
* \param[in] elementary_data Elementary matrices and vectors that will perform the calculations.
* \param[in,out] cauchy_green_tensor \a Parameter to update.
*
* \internal This constructor must not be called manually: it is involved only in
* GlobalParameterOperator<DerivedT, LocalParameterOperatorT>::CreateLocalOperatorList() method.
* \endinternal
*/
explicit GlobalCoordsQuadPoints(const ExtendedUnknown::const_shared_ptr& unknown_list,
elementary_data_type&& elementary_data,
ParameterAtQuadraturePoint
<
ParameterNS::Type::vector,
ParameterNS::TimeDependencyNS::None
>& global_coords_quad_pt);
//! Destructor.
~GlobalCoordsQuadPoints();
//! \copydoc doxygen_hide_copy_constructor
GlobalCoordsQuadPoints(const GlobalCoordsQuadPoints& rhs) = delete;
//! \copydoc doxygen_hide_move_constructor
GlobalCoordsQuadPoints(GlobalCoordsQuadPoints&& rhs) = delete;
//! \copydoc doxygen_hide_copy_affectation
GlobalCoordsQuadPoints& operator=(const GlobalCoordsQuadPoints& rhs) = delete;
//! \copydoc doxygen_hide_move_affectation
GlobalCoordsQuadPoints& operator=(GlobalCoordsQuadPoints&& rhs) = delete;
///@}
//! Compute the elementary vector.
void ComputeEltArray();
};
} // namespace LocalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
# include "OperatorInstances/ParameterOperator/Local/GlobalCoordsQuadPoints.hxx"
#endif // MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HPP_
/*!
//
// \file
//
//
// Created by Jérôme Diaz <jerome.diaz@inria.fr> on the Wed, 13 May 2020 16:53:38 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup OperatorInstancesGroup
// \addtogroup OperatorInstancesGroup
// \{
*/
#ifndef MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HXX_
# define MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HXX_
namespace MoReFEM
{
namespace LocalParameterOperatorNS
{
} // namespace LocalParameterOperatorNS
} // namespace MoReFEM
/// @} // addtogroup OperatorInstancesGroup
#endif // MOREFEM_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_WRITE_AT_QUAD_POINT_HXX_
......@@ -12,11 +12,14 @@ target_sources(${MOREFEM_OP_INSTANCES}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.cpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.cpp"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.hpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.hxx"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.hpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.hxx"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.hpp"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.hxx"
)
......@@ -12,12 +12,15 @@ target_sources(${MOREFEM_OP_INSTANCES}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.cpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.cpp"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.hpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateCauchyGreenTensor.hxx"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.hpp"
"${CMAKE_CURRENT_LIST_DIR}/UpdateFiberDeformation.hxx"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.hpp"
"${CMAKE_CURRENT_LIST_DIR}/GlobalCoordsQuadPoints.hxx"
)
include(${CMAKE_CURRENT_LIST_DIR}/Local/SourceList.cmake)
### ===================================================================================
### This file is generated automatically by Scripts/generate_cmake_source_list.py.
### Do not edit it manually!
### Convention is that:
### - When a CMake file is manually managed, it is named canonically CMakeLists.txt.
###. - When it is generated automatically, it is named SourceList.cmake.
### ===================================================================================
target_sources(${MOREFEM_PARAM_INSTANCES}
PRIVATE
)
### ===================================================================================
### This file is generated automatically by Scripts/generate_cmake_source_list.py.
### Do not edit it manually!
### Convention is that:
### - When a CMake file is manually managed, it is named canonically CMakeLists.txt.
###. - When it is generated automatically, it is named SourceList.cmake.
### ===================================================================================
target_sources(${MOREFEM_PARAM_INSTANCES}
PRIVATE
)
include(${CMAKE_CURRENT_LIST_DIR}/Internal/SourceList.cmake)
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