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

#1053 Test vertex matching: introduce a post processing which loads all the...

#1053 Test vertex matching: introduce a post processing which loads all the dofs information. Final step will be to check we find the same interface vertex content before and after the interpolation.
parent 816f10d0
......@@ -1822,6 +1822,8 @@
BEC157F01A249BB9007D20EB /* TupleHelper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEC157EF1A249BB9007D20EB /* TupleHelper.hpp */; };
BEC157F21A249C3D007D20EB /* Numeric.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEC157F11A249C3D007D20EB /* Numeric.hpp */; };
BEC37E0717DDC0210021BFB7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEC37E0617DDC0210021BFB7 /* Accelerate.framework */; };
BEC41AF91DDDEE5B00FDB0A4 /* libPostProcessing.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE45292A1A41AC3F006A1577 /* libPostProcessing.a */; };
BEC41AFD1DDDF3F000FDB0A4 /* CheckInterpolator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEC41AFA1DDDF3F000FDB0A4 /* CheckInterpolator.cpp */; };
BEC526FD1CC58462000E9027 /* LocalCoords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEC526F01CC58462000E9027 /* LocalCoords.cpp */; };
BEC526FE1CC58462000E9027 /* LocalCoords.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEC526F11CC58462000E9027 /* LocalCoords.hpp */; };
BEC526FF1CC58462000E9027 /* LocalCoords.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEC526F21CC58462000E9027 /* LocalCoords.hxx */; };
......@@ -4293,6 +4295,27 @@
remoteGlobalIDString = BE9C4D111807F5DC005B94BC;
remoteInfo = FiniteElement;
};
BEC41AF31DDDEE5400FDB0A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE5BC27016C008CF00232749 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BE451E2C1DAF78B500807035;
remoteInfo = ParameterInstances;
};
BEC41AF51DDDEE5400FDB0A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE5BC27016C008CF00232749 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BEABCEBC1AE65A9A00817D37;
remoteInfo = FormulationSolver;
};
BEC41AF71DDDEE5400FDB0A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE5BC27016C008CF00232749 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BE4529291A41AC3F006A1577;
remoteInfo = PostProcessing;
};
BEC77EA31DDDC8BE00F8B444 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE5BC27016C008CF00232749 /* Project object */;
......@@ -6510,6 +6533,9 @@
BEC1FC8418C470C600A4EB89 /* Yuni.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Yuni.hpp; sourceTree = "<group>"; };
BEC2F0AF1C3D6F6A004C1695 /* SConscript */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = SConscript; sourceTree = "<group>"; };
BEC37E0617DDC0210021BFB7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
BEC41AFA1DDDF3F000FDB0A4 /* CheckInterpolator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckInterpolator.cpp; sourceTree = "<group>"; };
BEC41AFB1DDDF3F000FDB0A4 /* CheckInterpolator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CheckInterpolator.hpp; sourceTree = "<group>"; };
BEC41AFC1DDDF3F000FDB0A4 /* CheckInterpolator.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CheckInterpolator.hxx; sourceTree = "<group>"; };
BEC526F01CC58462000E9027 /* LocalCoords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalCoords.cpp; sourceTree = "<group>"; };
BEC526F11CC58462000E9027 /* LocalCoords.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LocalCoords.hpp; sourceTree = "<group>"; };
BEC526F21CC58462000E9027 /* LocalCoords.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LocalCoords.hxx; sourceTree = "<group>"; };
......@@ -7660,6 +7686,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BEC41AF91DDDEE5B00FDB0A4 /* libPostProcessing.a in Frameworks */,
BEC77EB51DDDC8D300F8B444 /* libCore.a in Frameworks */,
BEC77EB61DDDC8D300F8B444 /* libFiniteElement.a in Frameworks */,
BEC77EB71DDDC8D300F8B444 /* libFormulationSolver.a in Frameworks */,
......@@ -12063,6 +12090,9 @@
BEC77E9D1DDDC39E00F8B444 /* Model.cpp */,
BEC77E9E1DDDC39E00F8B444 /* Model.hpp */,
BEC77E9F1DDDC39E00F8B444 /* Model.hxx */,
BEC41AFA1DDDF3F000FDB0A4 /* CheckInterpolator.cpp */,
BEC41AFB1DDDF3F000FDB0A4 /* CheckInterpolator.hpp */,
BEC41AFC1DDDF3F000FDB0A4 /* CheckInterpolator.hxx */,
);
path = FromVertexMatching;
sourceTree = "<group>";
......@@ -14913,6 +14943,9 @@
buildRules = (
);
dependencies = (
BEC41AF41DDDEE5400FDB0A4 /* PBXTargetDependency */,
BEC41AF61DDDEE5400FDB0A4 /* PBXTargetDependency */,
BEC41AF81DDDEE5400FDB0A4 /* PBXTargetDependency */,
BEC77EA41DDDC8BE00F8B444 /* PBXTargetDependency */,
BEC77EA61DDDC8BE00F8B444 /* PBXTargetDependency */,
BEC77EA81DDDC8BE00F8B444 /* PBXTargetDependency */,
......@@ -16207,6 +16240,7 @@
buildActionMask = 2147483647;
files = (
BEC77EA11DDDC39E00F8B444 /* Model.cpp in Sources */,
BEC41AFD1DDDF3F000FDB0A4 /* CheckInterpolator.cpp in Sources */,
BEC77EA01DDDC39E00F8B444 /* main.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -17837,6 +17871,21 @@
target = BE9C4D111807F5DC005B94BC /* FiniteElement */;
targetProxy = BEABCEC81AE65AB600817D37 /* PBXContainerItemProxy */;
};
BEC41AF41DDDEE5400FDB0A4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BE451E2C1DAF78B500807035 /* ParameterInstances */;
targetProxy = BEC41AF31DDDEE5400FDB0A4 /* PBXContainerItemProxy */;
};
BEC41AF61DDDEE5400FDB0A4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BEABCEBC1AE65A9A00817D37 /* FormulationSolver */;
targetProxy = BEC41AF51DDDEE5400FDB0A4 /* PBXContainerItemProxy */;
};
BEC41AF81DDDEE5400FDB0A4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BE4529291A41AC3F006A1577 /* PostProcessing */;
targetProxy = BEC41AF71DDDEE5400FDB0A4 /* PBXContainerItemProxy */;
};
BEC77EA41DDDC8BE00F8B444 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BEA8A378177AD4FE009436C9 /* Utilities */;
//! \file
//
//
// PostProcessing.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 17/11/16.
// Copyright © 2016 Inria. All rights reserved.
//
#include "HappyHeart/FiniteElement/FiniteElementSpace/GodOfDofManager.hpp"
#include "HappyHeart/PostProcessing/PostProcessing.hpp"
#include "HappyHeart/Test/Operators/NonConformInterpolator/FromVertexMatching/CheckInterpolator.hpp"
#include "HappyHeart/Test/Operators/NonConformInterpolator/FromVertexMatching/Model.hpp"
namespace HappyHeart
{
namespace TestVertexMatchingNS
{
namespace // anonymous
{
using result_type = std::unordered_map<unsigned int, std::vector<unsigned int> >;
void PerformComputationForRankAndNumberingSubset(const PostProcessingNS::PostProcessing& post_processing,
unsigned int rank,
NumberingSubsetIndex numbering_subset,
result_type& result);
} // namespace anonymous
void CheckInterpolator(const Model& model)
{
decltype(auto) mpi = model.MpiHappyHeart();
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance();
decltype(auto) solid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
decltype(auto) fluid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::fluid));
using namespace TestVertexMatchingNS;
PostProcessingNS::PostProcessing fluid_post_processing(model.GetOutputDirectory(),
{ EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid),
EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid) },
fluid_god_of_dof.GetGeometricMeshRegion());
PostProcessingNS::PostProcessing solid_post_processing(model.GetOutputDirectory(),
{ EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid),
EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid) },
solid_god_of_dof.GetGeometricMeshRegion());
const auto Nprocessor = mpi.template Nprocessor<unsigned int>();
result_type velocity_on_fluid_content;
result_type velocity_on_solid_content;
result_type pressure_on_fluid_content;
result_type pressure_on_solid_content;
velocity_on_fluid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
velocity_on_solid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
pressure_on_fluid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
pressure_on_solid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
velocity_on_fluid_content.reserve(fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid))));
velocity_on_solid_content.reserve(solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid))));
pressure_on_fluid_content.reserve(fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid))));
pressure_on_solid_content.reserve(solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid))));
for (auto rank = 0u; rank < Nprocessor; ++rank)
{
PerformComputationForRankAndNumberingSubset(fluid_post_processing,
rank,
NumberingSubsetIndex::velocity_on_fluid,
velocity_on_fluid_content);
PerformComputationForRankAndNumberingSubset(fluid_post_processing,
rank,
NumberingSubsetIndex::pressure_on_fluid,
pressure_on_fluid_content);
PerformComputationForRankAndNumberingSubset(solid_post_processing,
rank,
NumberingSubsetIndex::velocity_on_solid,
velocity_on_solid_content);
PerformComputationForRankAndNumberingSubset(solid_post_processing,
rank,
NumberingSubsetIndex::pressure_on_solid,
pressure_on_solid_content);
}
assert(velocity_on_fluid_content.size() == fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid))));
assert(velocity_on_solid_content.size() == solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid))));
assert(pressure_on_fluid_content.size() == fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid))));
assert(pressure_on_solid_content.size() == solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid))));
}
namespace // anonymous
{
void PerformComputationForRankAndNumberingSubset(const PostProcessingNS::PostProcessing& post_processing,
unsigned int rank,
NumberingSubsetIndex numbering_subset,
result_type& result)
{
decltype(auto) dof_list = post_processing.GetDofInformationList(EnumUnderlyingType(numbering_subset),
rank);
for (const auto& dof_ptr : dof_list)
{
assert(!(!dof_ptr));
const auto& dof = *dof_ptr;
const auto dof_index = dof.GetProgramWiseIndex();
const auto& interface = dof.GetInterface();
auto check = result.insert(std::make_pair(dof_index, interface.GetVertexCoordsIndexList()));
assert(check.second);
static_cast<void>(check);
}
}
} // namespace anonymous
} // namespace TestVertexMatchingNS
} // namespace HappyHeart
//! \file
//
//
// PostProcessing.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 17/11/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HPP_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HPP_
# include <memory>
# include <vector>
namespace HappyHeart
{
namespace TestVertexMatchingNS
{
// ============================
//! \cond IGNORE_BLOCK_IN_DOXYGEN
// Forward declarations.
// ============================
class Model;
// ============================
// End of forward declarations.
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
// ============================
/*!
* \brief Analyze the results of the test model and check the interpolator works as intended.
*
* \param[in] model The dummy \a Model used in current test.
*/
void CheckInterpolator(const Model& model);
} // namespace TestVertexMatchingNS
} // namespace HappyHeart
# include "HappyHeart/Test/Operators/NonConformInterpolator/FromVertexMatching/CheckInterpolator.hxx"
#endif // HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HPP_
//! \file
//
//
// PostProcessing.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 17/11/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HXX_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HXX_
namespace HappyHeart
{
namespace TestVertexMatchingNS
{
} // namespace TestVertexMatchingNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_CHECK_INTERPOLATOR_HXX_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_CONFORM_PROJECTOR_x_INPUT_PARAMETER_LIST_HPP_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_CONFORM_PROJECTOR_x_INPUT_PARAMETER_LIST_HPP_
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_INPUT_PARAMETER_LIST_HPP_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_INPUT_PARAMETER_LIST_HPP_
# include "HappyHeart/Utilities/Containers/EnumClass.hpp"
......@@ -21,12 +21,12 @@
namespace HappyHeart
{
namespace ConformProjectorNS
namespace TestVertexMatchingNS
{
enum class MeshIndex
{
fluid = 1,
......@@ -53,7 +53,7 @@ namespace HappyHeart
{
velocity = 1,
pressure = 2,
chaos = 3 // this unknown is just there to ensure the dof repartition is not the same for velocity and pressure.
};
......@@ -62,36 +62,36 @@ namespace HappyHeart
{
solver = 1
};
enum class NumberingSubsetIndex
enum class NumberingSubsetIndex : unsigned int
{
velocity_on_fluid = 10,
pressure_on_fluid = 11,
velocity_on_solid = 20,
pressure_on_solid = 21,
chaos = 22,
};
enum class InitVertexMatchingInterpolator
{
velocity_on_fluid = 10,
pressure_on_fluid = 11,
velocity_on_solid = 20,
pressure_on_solid = 21
};
using InputParameterTuple = std::tuple
<
InputParameter::TimeManager,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid)>,
InputParameter::NumberingSubset<EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid)>,
......@@ -101,36 +101,36 @@ namespace HappyHeart
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::velocity)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::pressure)>,
InputParameter::Unknown<EnumUnderlyingType(UnknownIndex::chaos)>,
InputParameter::Mesh<EnumUnderlyingType(MeshIndex::fluid)>,
InputParameter::Mesh<EnumUnderlyingType(MeshIndex::solid)>,
InputParameter::Domain<EnumUnderlyingType(DomainIndex::fluid)>,
InputParameter::Domain<EnumUnderlyingType(DomainIndex::solid)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::fluid)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::solid)>,
InputParameter::Petsc<EnumUnderlyingType(SolverIndex::solver)>,
InputParameter::InterpolationFile,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::pressure_on_solid)>,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::pressure_on_fluid)>,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::velocity_on_solid)>,
InputParameter::InitVertexMatchingInterpolator<EnumUnderlyingType(InitVertexMatchingInterpolator::velocity_on_fluid)>,
InputParameter::Result
>;
using InputParameterList = InputParameterList<InputParameterTuple>;
} // namespace ConformProjectorNS
} // namespace TestVertexMatchingNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_TEST_x_OPERATORS_x_CONFORM_PROJECTOR_x_INPUT_PARAMETER_LIST_HPP_
#endif // HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_INPUT_PARAMETER_LIST_HPP_
......@@ -15,7 +15,7 @@ namespace HappyHeart
{
namespace ConformProjectorNS
namespace TestVertexMatchingNS
{
......@@ -99,7 +99,7 @@ namespace HappyHeart
{ }
} // namespace ConformProjectorNS
} // namespace TestVertexMatchingNS
} // namespace HappyHeart
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_CONFORM_PROJECTOR_x_MODEL_HPP_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_CONFORM_PROJECTOR_x_MODEL_HPP_
#ifndef HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_MODEL_HPP_
# define HAPPY_HEART_x_TEST_x_OPERATORS_x_NON_CONFORM_INTERPOLATOR_x_FROM_VERTEX_MATCHING_x_MODEL_HPP_
# include <memory>
# include <vector>
......@@ -23,36 +23,36 @@
namespace HappyHeart
{
namespace ConformProjectorNS
namespace TestVertexMatchingNS
{
class Model : public HappyHeart::Model<Model, DoConsiderProcessorWiseLocal2Global::yes>
{
private:
//! \copydoc doxygen_hide_alias_self
using self = Model;
//! Convenient alias.
using parent = HappyHeart::Model<Model, DoConsiderProcessorWiseLocal2Global::yes>;
public:
//! Return the name of the model.
static const std::string& ClassName();
//! Friendship granted to the base class so this one can manipulates private methods.
friend parent;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
......@@ -60,62 +60,62 @@ namespace HappyHeart
*/
Model(const Wrappers::Mpi& mpi,
const InputParameterList& input_parameter_data);
//! Destructor.
~Model() = default;
//! Copy constructor.
Model(const Model&) = delete;
//! Move constructor.
Model(Model&&) = delete;
//! Copy affectation.
Model& operator=(const Model&) = delete;
//! Move affectation.
Model& operator=(Model&&) = delete;
///@}
/// \name Crtp-required methods.
///@{
/*!
* \brief Initialise the problem.