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

#1443 Introduce new input data to load pre-partitioned data, and the embryo of...

#1443 Introduce new input data to load pre-partitioned data, and the embryo of a new test I will use while implementing the feature.
parent 73e11dc2
......@@ -3272,6 +3272,14 @@
BE168F061CC97F120090AC88 /* Triangle3.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Triangle3.hpp; sourceTree = "<group>"; };
BE168F071CC97F120090AC88 /* Triangle6.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Triangle6.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
BE168F081CC97F120090AC88 /* Triangle6.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Triangle6.hpp; sourceTree = "<group>"; };
BE17539E22E2087200C78FCF /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
BE17539F22E2087200C78FCF /* demo.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = demo.lua; sourceTree = "<group>"; };
BE1753A022E2087200C78FCF /* Model.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Model.hpp; sourceTree = "<group>"; };
BE1753A122E2087200C78FCF /* InputData.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = InputData.hpp; sourceTree = "<group>"; };
BE1753A222E2087200C78FCF /* README */ = {isa = PBXFileReference; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
BE1753A322E2087200C78FCF /* Model.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Model.hxx; sourceTree = "<group>"; };
BE1753A422E2087200C78FCF /* Model.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Model.cpp; sourceTree = "<group>"; };
BE1753A522E2087200C78FCF /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
BE1798131E316640004326D2 /* Traits.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Traits.hpp; sourceTree = "<group>"; };
BE18EB0C2003A21E002FEC2C /* ModelInstances.doxygen */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ModelInstances.doxygen; sourceTree = "<group>"; };
BE19AB511A37354100EAF725 /* SegmentP1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentP1.cpp; sourceTree = "<group>"; };
......@@ -6410,6 +6418,21 @@
path = Triangle;
sourceTree = "<group>";
};
BE17539D22E2087200C78FCF /* LoadPrepartitionedMesh */ = {
isa = PBXGroup;
children = (
BE1753A222E2087200C78FCF /* README */,
BE17539E22E2087200C78FCF /* CMakeLists.txt */,
BE17539F22E2087200C78FCF /* demo.lua */,
BE1753A522E2087200C78FCF /* main.cpp */,
BE1753A122E2087200C78FCF /* InputData.hpp */,
BE1753A422E2087200C78FCF /* Model.cpp */,
BE1753A022E2087200C78FCF /* Model.hpp */,
BE1753A322E2087200C78FCF /* Model.hxx */,
);
path = LoadPrepartitionedMesh;
sourceTree = "<group>";
};
BE1ABADD1B9DC78000A7DBD8 /* P1_to_HigherOrder */ = {
isa = PBXGroup;
children = (
......@@ -6724,6 +6747,7 @@
BE1EBAFB1CA0954C00EC0EAA /* Coloring */,
BE2808BF1F4C6DBF005A2CED /* CoordsInParallel */,
BE63B4331F4F298800F03800 /* Movemesh */,
BE17539D22E2087200C78FCF /* LoadPrepartitionedMesh */,
BE5B8E751F6DBB68007816CC /* NcoordInDomain */,
);
path = Geometry;
......@@ -53,7 +53,7 @@
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
FilePath = "/Volumes/Data/opt/clang/Openmpi/bin/orterun">
FilePath = "/Volumes/Data/opt/clang_debug/Openmpi/bin/orterun">
</PathRunnable>
<MacroExpansion>
<BuildableReference
......
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Thu, 19 Feb 2015 14:38:32 +0100
// Copyright (c) Inria. All rights reserved.
//
// \ingroup CoreGroup
// \addtogroup CoreGroup
// \{
*/
#include "Utilities/String/EmptyString.hpp"
#include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM
{
namespace InputDataNS
{
const std::string& PrepartitionedData::GetName()
{
static std::string ret("PrepartitionedData");
return ret;
}
const std::string& PrepartitionedData::Directory::NameInFile()
{
static std::string ret("Directory");
return ret;
}
const std::string& PrepartitionedData::Directory::Description()
{
static std::string ret("Directory in which prepartitioned data are stored. Leave it empty if irrelevant.");
return ret;
}
const std::string& PrepartitionedData::Directory::Constraint()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::Directory::DefaultValue()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::IsPrepartitionRun::NameInFile()
{
static std::string ret("is_prepartition_run");
return ret;
}
const std::string& PrepartitionedData::IsPrepartitionRun::Description()
{
static std::string ret("If True, the program runs to generate prepartition data and will stop once it's "
"done. If False, mode will be run with pre-computed prepartitioned data (if "
"directory is not empty) or will not use them (and compute them on the fly if "
"parallel mode).");
return ret;
}
const std::string& PrepartitionedData::IsPrepartitionRun::Constraint()
{
return Utilities::EmptyString();
}
const std::string& PrepartitionedData::IsPrepartitionRun::DefaultValue()
{
static std::string ret("False");
return ret;
}
} // namespace InputDataNS
} // namespace MoReFEM
/// @} // addtogroup CoreGroup
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Tue, 27 Aug 2013 11:26:39 +0200
// Copyright (c) Inria. All rights reserved.
//
// \ingroup CoreGroup
// \addtogroup CoreGroup
// \{
*/
#ifndef MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
# define MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
# include <string>
# include "Core/InputData/Instances/Crtp/Section.hpp"
namespace MoReFEM::InputDataNS
{
//! \copydoc doxygen_hide_core_input_data_section
struct PrepartitionedData : public Crtp::Section<PrepartitionedData, NoEnclosingSection>
{
//! Return the name of the section in the input parameter.
static const std::string& GetName();
//! Convenient alias.
using self = PrepartitionedData;
//! Friendship to section parent.
using parent = Crtp::Section<self, NoEnclosingSection>;
//! \cond IGNORE_BLOCK_IN_DOXYGEN
friend parent;
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
//! Directory in which preprocessed data are stored.
struct Directory : public Crtp::InputData<Directory, self, std::string>
{
//! Name of the input parameter in Lua input file.
static const std::string& NameInFile();
//! Description of the input parameter.
static const std::string& Description();
/*!
* \return Constraint to fulfill.
*
* Might be left empty; if not the format to respect is the \a LuaOptionFile one. Hereafter some text from \a LuaOptionFile example file:
*
* An age should be greater than 0 and less than, say, 150. It is possible
* to check it with a logical expression (written in Lua). The expression
* should be written with 'v' being the variable to be checked.
* \a constraint = "v >= 0 and v < 150"
*
* It is possible to check whether a variable is in a set of acceptable
* value. This is performed with 'value_in' (a Lua function defined by \a LuaOptionFile).
* \a constraint = "value_in(v, {'Messiah', 'Water Music'})"
*
* If a vector is retrieved, the constraint must be satisfied on every
* element of the vector.
*/
static const std::string& Constraint();
/*!
* \return Default value.
*
* This is intended to be used only when the class is used to create a default file; never when no value has been given
* in the input data file (doing so is too much error prone...)
*
* This is given as a string; if no default value return an empty string. The value must be \a LuaOptionFile-formatted.
*/
static const std::string& DefaultValue();
};
//! Whether we intend to run a model or just pre-process it for later parallel use.
struct IsPrepartitionRun : public Crtp::InputData<IsPrepartitionRun, self, bool>
{
//! Name of the input parameter in Lua input file.
static const std::string& NameInFile();
//! Description of the input parameter.
static const std::string& Description();
/*!
* \return Constraint to fulfill.
*
* Might be left empty; if not the format to respect is the \a LuaOptionFile one. Hereafter some text from \a LuaOptionFile example file:
*
* An age should be greater than 0 and less than, say, 150. It is possible
* to check it with a logical expression (written in Lua). The expression
* should be written with 'v' being the variable to be checked.
* \a constraint = "v >= 0 and v < 150"
*
* It is possible to check whether a variable is in a set of acceptable
* value. This is performed with 'value_in' (a Lua function defined by \a LuaOptionFile).
* \a constraint = "value_in(v, {'Messiah', 'Water Music'})"
*
* If a vector is retrieved, the constraint must be satisfied on every
* element of the vector.
*/
static const std::string& Constraint();
/*!
* \return Default value.
*
* This is intended to be used only when the class is used to create a default file; never when no value has been given
* in the input data file (doing so is too much error prone...)
*
* This is given as a string; if no default value return an empty string. The value must be \a LuaOptionFile-formatted.
*/
static const std::string& DefaultValue();
};
//! Alias to the tuple of structs.
using section_content_type = std::tuple
<
Directory,
IsPrepartitionRun
>;
private:
//! Content of the section.
section_content_type section_content_;
}; // struct PrepartitionedData
} // namespace MoReFEM::InputDataNS
/// @} // addtogroup CoreGroup
#endif // MOREFEM_x_CORE_x_INPUT_DATA_x_INSTANCES_x_PREPARTITIONED_DATA_HPP_
......@@ -11,12 +11,14 @@ target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.cpp"
"${CMAKE_CURRENT_LIST_DIR}/PrepartitionedData.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Result.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.hpp"
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hpp"
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hxx"
"${CMAKE_CURRENT_LIST_DIR}/PrepartitionedData.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Result.hpp"
)
......
......@@ -274,8 +274,6 @@ namespace MoReFEM
}
namespace // anonymous
{
......
......@@ -258,14 +258,14 @@ namespace MoReFEM
* \copydoc doxygen_hide_mesh_constructor_5
*/
explicit Mesh(unsigned int unique_id,
const std::string& mesh_file,
unsigned dimension,
::MoReFEM::MeshNS::Format format,
const double space_unit,
BuildEdge do_build_edge = BuildEdge::no,
BuildFace do_build_face = BuildFace::no,
BuildVolume do_build_volume = BuildVolume::no,
BuildPseudoNormals do_build_pseudo_normals = BuildPseudoNormals::no);
const std::string& mesh_file,
unsigned dimension,
::MoReFEM::MeshNS::Format format,
const double space_unit,
BuildEdge do_build_edge = BuildEdge::no,
BuildFace do_build_face = BuildFace::no,
BuildVolume do_build_volume = BuildVolume::no,
BuildPseudoNormals do_build_pseudo_normals = BuildPseudoNormals::no);
/*!
......
......@@ -5,3 +5,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/DomainListInCoords/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/Movemesh/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/NcoordInDomain/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/LoadPrepartitionedMesh/CMakeLists.txt)
add_executable(MoReFEMTestLoadPrepartitionedMesh
${CMAKE_CURRENT_LIST_DIR}/InputData.hpp
${CMAKE_CURRENT_LIST_DIR}/Model.cpp
${CMAKE_CURRENT_LIST_DIR}/Model.hpp
${CMAKE_CURRENT_LIST_DIR}/Model.hxx
${CMAKE_CURRENT_LIST_DIR}/main.cpp
)
target_link_libraries(MoReFEMTestLoadPrepartitionedMesh
${MOREFEM_TEST_TOOLS}
)
add_test(LoadPrepartitionedMesh
${OPEN_MPI_INCL_DIR}/../bin/mpirun
--oversubscribe
-np 4 MoReFEMTestLoadPrepartitionedMesh
--
${MOREFEM_ROOT}
${MOREFEM_TEST_OUTPUT_DIR})
/*!
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Sun, 18 Nov 2018 22:29:38 +0100
// Copyright (c) Inria. All rights reserved.
//
*/
#ifndef MOREFEM_x_TEST_x_GEOMETRY_x_LOAD_PREPARTITIONED_MESH_x_INPUT_DATA_HPP_
# define MOREFEM_x_TEST_x_GEOMETRY_x_LOAD_PREPARTITIONED_MESH_x_INPUT_DATA_HPP_
# include "Utilities/Containers/EnumClass.hpp"
# include "Core/InputData/InputData.hpp"
# include "Core/InputData/Instances/TimeManager/TimeManager.hpp"
# include "Core/InputData/Instances/Geometry/Domain.hpp"
# include "Core/InputData/Instances/Geometry/Mesh.hpp"
# include "Core/InputData/Instances/Solver/Petsc.hpp"
# include "Core/InputData/Instances/FElt/Unknown.hpp"
# include "Core/InputData/Instances/FElt/NumberingSubset.hpp"
# include "Core/InputData/Instances/FElt/FEltSpace.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Core/InputData/Instances/PrepartitionedData.hpp"
namespace MoReFEM
{
namespace TestNS
{
namespace LoadPrepartitionedMeshNS
{
//! \copydoc doxygen_hide_mesh_enum
enum class MeshIndex
{
mesh = 1
};
//! Default value for some input parameter that are required by a MoReFEM model but are actually unused
//! for current test.
constexpr auto whatever = 1;
//! \copydoc doxygen_hide_input_data_tuple
using InputDataTuple = std::tuple
<
InputDataNS::TimeManager,
InputDataNS::Mesh<EnumUnderlyingType(MeshIndex::mesh)>,
InputDataNS::Unknown<whatever>,
InputDataNS::Domain<whatever>,
InputDataNS::NumberingSubset<whatever>,
InputDataNS::FEltSpace<whatever>,
InputDataNS::Petsc<whatever>,
InputDataNS::Result,
InputDataNS::PrepartitionedData
>;
//! \copydoc doxygen_hide_model_specific_input_data
using InputData = InputData<InputDataTuple>;
//! \copydoc doxygen_hide_morefem_data_type
using morefem_data_type = MoReFEMData<InputData>;
} // namespace LoadPrepartitionedMeshNS
} // namespace TestNS
} // namespace MoReFEM
#endif // MOREFEM_x_TEST_x_GEOMETRY_x_LOAD_PREPARTITIONED_MESH_x_INPUT_DATA_HPP_
/*!
// \file
//
//
// Created by Gautier Bureau <gautier.bureau@inria.fr> on the Fri, 28 Jul 2017 12:12:25 +0200
// Copyright (c) Inria. All rights reserved.
//
*/
#include "ThirdParty/IncludeWithoutWarning/Boost/Test.hpp"
#include "Test/Geometry/LoadPrepartitionedMesh/Model.hpp"
namespace MoReFEM
{
namespace TestNS
{
namespace LoadPrepartitionedMeshNS
{
Model::Model(const morefem_data_type& morefem_data)
: parent(morefem_data)
{ }
namespace // anonymous
{
} // namespace anonymous
void Model::SupplInitialize()
{
}
namespace // anonymous
{
} // namespace anonymous
void Model::Forward()
{ }
void Model::SupplFinalizeStep()
{ }
void Model::SupplFinalize()
{ }
} // namespace LoadPrepartitionedMeshNS
} // namespace TestNS
} // namespace MoReFEM
/*!
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Fri, 14 Apr 2017 16:21:23 +0200
// Copyright (c) Inria. All rights reserved.
//
*/
#ifndef MOREFEM_x_TEST_x_GEOMETRY_x_LOAD_PREPARTITIONED_MESH_x_MODEL_HPP_
# define MOREFEM_x_TEST_x_GEOMETRY_x_LOAD_PREPARTITIONED_MESH_x_MODEL_HPP_
# include <memory>
# include <vector>
# include "Core/InputData/Instances/Result.hpp"
# include "Model/Model.hpp"
# include "Test/Geometry/LoadPrepartitionedMesh/InputData.hpp"
namespace MoReFEM
{
namespace TestNS
{
namespace LoadPrepartitionedMeshNS
{
/*!
* \brief Toy model used to perform tests about variable domain.
*
*/
//! \copydoc doxygen_hide_model_4_test
class Model : public MoReFEM::Model<Model, morefem_data_type, DoConsiderProcessorWiseLocal2Global::no>
{
private:
//! \copydoc doxygen_hide_alias_self
using self = Model;
//! Convenient alias.