Skip to content
Snippets Groups Projects
Unverified Commit ae82fdd2 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by GitHub
Browse files

Merge pull request #2159 from endJunction/RefactorPartMeshTool

Refactor part mesh tool
parents 078f26cb 5df7f9b8
No related branches found
No related tags found
No related merge requests found
Showing
with 1967 additions and 625 deletions
...@@ -19,6 +19,4 @@ target_link_libraries(createNeumannBc ...@@ -19,6 +19,4 @@ target_link_libraries(createNeumannBc
${OGS_VTK_REQUIRED_LIBS} ${OGS_VTK_REQUIRED_LIBS}
) )
if(OGS_BUILD_METIS) add_subdirectory(PartitionMesh)
add_subdirectory(PartitionMesh)
endif()
add_executable(partmesh PartitionMesh.cpp NodeWiseMeshPartitioner.h NodeWiseMeshPartitioner.cpp) add_executable(partmesh PartitionMesh.cpp Metis.cpp NodeWiseMeshPartitioner.cpp)
set_target_properties(partmesh PROPERTIES FOLDER Utilities) set_target_properties(partmesh PROPERTIES FOLDER Utilities)
target_link_libraries(partmesh MeshLib) target_link_libraries(partmesh MeshLib)
add_dependencies(partmesh mpmetis)
#################### ####################
### Installation ### ### Installation ###
......
/**
* \file
*
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include <iostream>
#include "BaseLib/Error.h"
#include "MeshLib/Elements/Element.h"
namespace ApplicationUtils
{
void writeMETIS(std::vector<MeshLib::Element*> const& elements,
const std::string& file_name)
{
std::ofstream os(file_name, std::ios::trunc);
if (!os.is_open())
{
OGS_FATAL("Error: cannot open file %s.", file_name.data());
}
if (!os.good())
{
OGS_FATAL("Error: Cannot write in file %s.", file_name.data());
}
os << elements.size() << " \n";
for (const auto* elem : elements)
{
os << elem->getNodeIndex(0) + 1;
for (unsigned j = 1; j < elem->getNumberOfNodes(); j++)
{
os << " " << elem->getNodeIndex(j) + 1;
}
os << "\n";
}
}
std::vector<std::size_t> readMetisData(const std::string& file_name_base,
long const number_of_partitions,
std::size_t const number_of_nodes)
{
const std::string npartitions_str = std::to_string(number_of_partitions);
// Read partitioned mesh data from METIS
const std::string fname_parts =
file_name_base + ".mesh.npart." + npartitions_str;
std::ifstream npart_in(fname_parts);
if (!npart_in.is_open())
{
OGS_FATAL(
"Error: cannot open file %s. It may not exist!\n"
"Run mpmetis beforehand or use option -m",
fname_parts.data());
}
std::vector<std::size_t> partition_ids(number_of_nodes);
std::size_t counter = 0;
while (!npart_in.eof())
{
npart_in >> partition_ids[counter++] >> std::ws;
if (counter == number_of_nodes)
{
break;
}
}
if (npart_in.bad())
{
OGS_FATAL("Error while reading file %s.", fname_parts.data());
}
if (counter != number_of_nodes)
{
OGS_FATAL("Error: data in %s are less than expected.",
fname_parts.data());
}
return partition_ids;
}
void removeMetisPartitioningFiles(std::string const& file_name_base,
long const number_of_partitions)
{
const std::string npartitions_str = std::to_string(number_of_partitions);
std::remove((file_name_base + ".mesh.npart." + npartitions_str).c_str());
std::remove((file_name_base + ".mesh.epart." + npartitions_str).c_str());
}
} // namespace ApplicationUtils
/**
* \file
*
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <string>
#include <vector>
namespace MeshLib
{
class Element;
}
namespace ApplicationUtils
{
/// Write elements as METIS graph file
/// \param elements The mesh elements.
/// \param file_name File name with an extension of mesh.
void writeMETIS(std::vector<MeshLib::Element*> const& elements,
const std::string& file_name);
/// Read metis data
/// \param file_name_base The prefix of the filename.
/// \param number_of_partitions The number is used to compose the full filename
/// and forms the postfix.
/// \param number_of_nodes Expected/required number of nodes to be read.
std::vector<std::size_t> readMetisData(const std::string& file_name_base,
long number_of_partitions,
std::size_t number_of_nodes);
/// Removes the F.mesh.npart.P and F.mesh.epart.P files, where F is file name
/// base and P is the number of partitions.
void removeMetisPartitioningFiles(std::string const& file_name_base,
long number_of_partitions);
} // namespace ApplicationUtils
...@@ -15,15 +15,14 @@ ...@@ -15,15 +15,14 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <string>
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#include <string>
#include <fstream>
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshLib/Elements/Element.h" #include "MeshLib/Elements/Element.h"
#include "MeshLib/IO/MPI_IO/PropertyVectorMetaData.h" #include "MeshLib/IO/MPI_IO/PropertyVectorMetaData.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
namespace ApplicationUtils namespace ApplicationUtils
{ {
...@@ -34,9 +33,19 @@ struct Partition ...@@ -34,9 +33,19 @@ struct Partition
std::size_t number_of_non_ghost_base_nodes; std::size_t number_of_non_ghost_base_nodes;
std::size_t number_of_non_ghost_nodes; std::size_t number_of_non_ghost_nodes;
std::size_t number_of_base_nodes; std::size_t number_of_base_nodes;
std::size_t number_of_mesh_base_nodes;
std::size_t number_of_mesh_all_nodes;
/// Non ghost elements /// Non ghost elements
std::vector<const MeshLib::Element*> regular_elements; std::vector<const MeshLib::Element*> regular_elements;
std::vector<const MeshLib::Element*> ghost_elements; std::vector<const MeshLib::Element*> ghost_elements;
std::size_t numberOfMeshItems(MeshLib::MeshItemType const item_type) const;
std::ostream& writeNodesBinary(
std::ostream& os,
std::vector<std::size_t> const& global_node_ids) const;
std::ostream& writeConfigBinary(std::ostream& os) const;
}; };
/// Mesh partitioner. /// Mesh partitioner.
...@@ -67,14 +76,6 @@ public: ...@@ -67,14 +76,6 @@ public:
/// interpolation /// interpolation
void partitionByMETIS(const bool is_mixed_high_order_linear_elems); void partitionByMETIS(const bool is_mixed_high_order_linear_elems);
/// Read metis data
/// \param file_name_base The prefix of the file name.
void readMetisData(const std::string& file_name_base);
/// Write mesh to METIS input file
/// \param file_name File name with an extension of mesh.
void writeMETIS(const std::string& file_name);
/// Write the partitions into ASCII files /// Write the partitions into ASCII files
/// \param file_name_base The prefix of the file name. /// \param file_name_base The prefix of the file name.
void writeASCII(const std::string& file_name_base); void writeASCII(const std::string& file_name_base);
...@@ -83,6 +84,14 @@ public: ...@@ -83,6 +84,14 @@ public:
/// \param file_name_base The prefix of the file name. /// \param file_name_base The prefix of the file name.
void writeBinary(const std::string& file_name_base); void writeBinary(const std::string& file_name_base);
void resetPartitionIdsForNodes(
std::vector<std::size_t>&& node_partition_ids)
{
_nodes_partition_ids = std::move(node_partition_ids);
}
MeshLib::Mesh const& mesh() const { return *_mesh; }
private: private:
/// Number of partitions. /// Number of partitions.
IntegerType _npartitions; IntegerType _npartitions;
...@@ -108,32 +117,6 @@ private: ...@@ -108,32 +117,6 @@ private:
/// interpolation /// interpolation
void renumberNodeIndices(const bool is_mixed_high_order_linear_elems); void renumberNodeIndices(const bool is_mixed_high_order_linear_elems);
/*!
Calculate the total number of integer variables of an element
vector. Each element has three integer variables for element ID,
element type, number of nodes of the element. Therefore
the total number of the integers in an element vector is
3 * vector size + sum (number of nodes of each element)
*/
IntegerType getNumberOfIntegerVariablesOfElements(
const std::vector<const MeshLib::Element*>& elements) const;
/*!
\brief Get integer variables, which are used to define an element
\param elem Element
\param local_node_ids Local node indices of a partition
\param elem_info A vector holds all integer variables of
element definitions
\param counter Recorder of the number of integer variables.
*/
void getElementIntegerVariables(const MeshLib::Element& elem,
const std::vector<IntegerType>& local_node_ids,
std::vector<IntegerType>& elem_info,
IntegerType& counter);
void writeNodePropertiesBinary(std::string const& file_name_base) const;
void writeCellPropertiesBinary(std::string const& file_name_base) const;
/// 1 copy pointers to nodes belonging to the partition part_id /// 1 copy pointers to nodes belonging to the partition part_id
/// 2 collect non-linear element nodes belonging to the partition part_id in /// 2 collect non-linear element nodes belonging to the partition part_id in
/// extra_nodes /// extra_nodes
...@@ -156,146 +139,16 @@ private: ...@@ -156,146 +139,16 @@ private:
const bool is_mixed_high_order_linear_elems, const bool is_mixed_high_order_linear_elems,
std::vector<MeshLib::Node*>& extra_nodes); std::vector<MeshLib::Node*>& extra_nodes);
void splitOfHigherOrderNode(std::vector<MeshLib::Node*> const& nodes, void splitOffHigherOrderNode(std::vector<MeshLib::Node*> const& nodes,
bool const is_mixed_high_order_linear_elems, bool const is_mixed_high_order_linear_elems,
unsigned const node_id, unsigned const node_id,
std::vector<MeshLib::Node*>& base_nodes, std::vector<MeshLib::Node*>& base_nodes,
std::vector<MeshLib::Node*>& extra_nodes); std::vector<MeshLib::Node*>& extra_nodes);
void processPartition(std::size_t const part_id, void processPartition(std::size_t const part_id,
const bool is_mixed_high_order_linear_elems); const bool is_mixed_high_order_linear_elems);
void processNodeProperties(); void processProperties(MeshLib::MeshItemType const mesh_item_type);
void processCellProperties();
template <typename T>
bool copyNodePropertyVector(std::string const& name,
std::size_t const total_number_of_tuples)
{
auto const& original_properties(_mesh->getProperties());
if (!original_properties.existsPropertyVector<T>(name))
return false;
auto const& pv(original_properties.getPropertyVector<T>(name));
auto partitioned_pv =
_partitioned_properties.createNewPropertyVector<T>(
name, pv->getMeshItemType(), pv->getNumberOfComponents());
partitioned_pv->resize(total_number_of_tuples *
pv->getNumberOfComponents());
std::size_t position_offset(0);
for (auto p : _partitions)
{
for (std::size_t i = 0; i < p.nodes.size(); ++i)
{
const auto global_id = p.nodes[i]->getID();
(*partitioned_pv)[position_offset + i] = (*pv)[global_id];
}
position_offset += p.nodes.size();
}
return true;
}
template <typename T>
bool copyCellPropertyVector(std::string const& name,
std::size_t const total_number_of_tuples)
{
auto const& original_properties(_mesh->getProperties());
if (!original_properties.existsPropertyVector<T>(name))
return false;
auto const& pv(original_properties.getPropertyVector<T>(name));
auto partitioned_pv =
_partitioned_properties.createNewPropertyVector<T>(
name, pv->getMeshItemType(), pv->getNumberOfComponents());
partitioned_pv->resize(total_number_of_tuples *
pv->getNumberOfComponents());
std::size_t position_offset(0);
for (auto const& p : _partitions)
{
std::size_t const n_regular(p.regular_elements.size());
for (std::size_t i = 0; i < n_regular; ++i)
{
const auto id = p.regular_elements[i]->getID();
(*partitioned_pv)[position_offset + i] = (*pv)[id];
}
position_offset += n_regular;
std::size_t const n_ghost(p.ghost_elements.size());
for (std::size_t i = 0; i < n_ghost; ++i)
{
const auto id = p.ghost_elements[i]->getID();
(*partitioned_pv)[position_offset + i] = (*pv)[id];
}
position_offset += n_ghost;
}
return true;
}
template <typename T>
void writePropertyVectorValuesBinary(
std::ostream& os, MeshLib::PropertyVector<T> const& pv) const
{
std::size_t number_of_components(pv.getNumberOfComponents());
std::size_t number_of_tuples(pv.getNumberOfTuples());
std::vector<T> property_vector_buffer;
property_vector_buffer.resize(number_of_tuples * number_of_components);
for (std::size_t i = 0; i < pv.getNumberOfTuples(); ++i)
{
for (std::size_t c(0); c < number_of_components; ++c)
property_vector_buffer[i * number_of_components + c] =
pv.getComponent(i, c);
}
os.write(reinterpret_cast<char*>(property_vector_buffer.data()),
number_of_components * number_of_tuples * sizeof(T));
}
template <typename T>
bool writePropertyVectorBinary(std::string const& name,
std::ostream& out_val,
std::ostream& out_meta) const
{
if (!_partitioned_properties.existsPropertyVector<T>(name))
return false;
MeshLib::IO::PropertyVectorMetaData pvmd;
pvmd.property_name = name;
auto* pv = _partitioned_properties.getPropertyVector<T>(name);
pvmd.fillPropertyVectorMetaDataTypeInfo<T>();
pvmd.number_of_components = pv->getNumberOfComponents();
pvmd.number_of_tuples = pv->getNumberOfTuples();
writePropertyVectorValuesBinary(out_val, *pv);
MeshLib::IO::writePropertyVectorMetaDataBinary(out_meta, pvmd);
return true;
}
/*!
\brief Write the configuration data of the partition data in
binary files.
\param file_name_base The prefix of the file name.
\return element 1: The numbers of all non-ghost element integer
variables of each partitions.
element 2: The numbers of all ghost element integer
variables of each partitions.
*/
std::tuple<std::vector<IntegerType>, std::vector<IntegerType>>
writeConfigDataBinary(const std::string& file_name_base);
/*!
\brief Write the element integer variables of all partitions
into binary files.
\param file_name_base The prefix of the file name.
\param num_elem_integers The numbers of all non-ghost element
integer variables of each partitions.
\param num_g_elem_integers The numbers of all ghost element
integer variables of each partitions.
*/
void writeElementsBinary(const std::string& file_name_base,
const std::vector<IntegerType>& num_elem_integers,
const std::vector<IntegerType>& num_g_elem_integers);
/// Write the nodes of all partitions into a binary file.
/// \param file_name_base The prefix of the file name.
void writeNodesBinary(const std::string& file_name_base);
/// Write the configuration data of the partition data in ASCII files. /// Write the configuration data of the partition data in ASCII files.
/// \param file_name_base The prefix of the file name. /// \param file_name_base The prefix of the file name.
...@@ -322,4 +175,4 @@ private: ...@@ -322,4 +175,4 @@ private:
const std::vector<IntegerType>& local_node_ids); const std::vector<IntegerType>& local_node_ids);
}; };
} // namespace MeshLib } // namespace ApplicationUtils
...@@ -21,13 +21,16 @@ ...@@ -21,13 +21,16 @@
#endif #endif
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
#include "BaseLib/FileTools.h"
#include "BaseLib/CPUTime.h" #include "BaseLib/CPUTime.h"
#include "BaseLib/FileTools.h"
#include "BaseLib/RunTime.h" #include "BaseLib/RunTime.h"
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "NodeWiseMeshPartitioner.h" #include "NodeWiseMeshPartitioner.h"
#include "Metis.h"
using namespace ApplicationUtils;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
...@@ -50,6 +53,12 @@ int main(int argc, char* argv[]) ...@@ -50,6 +53,12 @@ int main(int argc, char* argv[])
"the name of the file containing the input mesh", true, "", "the name of the file containing the input mesh", true, "",
"file name of input mesh"); "file name of input mesh");
cmd.add(mesh_input); cmd.add(mesh_input);
TCLAP::ValueArg<std::string> output_directory_arg(
"o", "output", "directory name for the output files", false, "",
"directory");
cmd.add(output_directory_arg);
TCLAP::ValueArg<int> nparts("n", "np", "the number of partitions", false, 2, TCLAP::ValueArg<int> nparts("n", "np", "the number of partitions", false, 2,
"integer"); "integer");
cmd.add(nparts); cmd.add(nparts);
...@@ -78,84 +87,84 @@ int main(int argc, char* argv[]) ...@@ -78,84 +87,84 @@ int main(int argc, char* argv[])
BaseLib::CPUTime CPU_timer; BaseLib::CPUTime CPU_timer;
CPU_timer.start(); CPU_timer.start();
const std::string ifile_name = mesh_input.getValue(); const std::string input_file_name_wo_extension =
const std::string file_name_base = BaseLib::dropFileExtension(ifile_name); BaseLib::dropFileExtension(mesh_input.getValue());
std::unique_ptr<MeshLib::Mesh> mesh_ptr( std::unique_ptr<MeshLib::Mesh> mesh_ptr(
MeshLib::IO::readMeshFromFile(file_name_base + ".vtu")); MeshLib::IO::readMeshFromFile(input_file_name_wo_extension + ".vtu"));
INFO("Mesh read: %d nodes, %d elements.", INFO("Mesh read: %d nodes, %d elements.",
mesh_ptr->getNumberOfNodes(), mesh_ptr->getNumberOfNodes(),
mesh_ptr->getNumberOfElements()); mesh_ptr->getNumberOfElements());
std::size_t const number_of_nodes(mesh_ptr->getNumberOfNodes()); if (ogs2metis_flag.getValue())
std::size_t const number_of_elements(mesh_ptr->getNumberOfElements()); {
INFO("Write the mesh into METIS input file.");
ApplicationUtils::writeMETIS(mesh_ptr->getElements(),
input_file_name_wo_extension + ".mesh");
INFO("Total runtime: %g s.", run_timer.elapsed());
INFO("Total CPU time: %g s.", CPU_timer.elapsed());
return EXIT_SUCCESS;
}
ApplicationUtils::NodeWiseMeshPartitioner mesh_partitioner( ApplicationUtils::NodeWiseMeshPartitioner mesh_partitioner(
nparts.getValue(), std::move(mesh_ptr)); nparts.getValue(), std::move(mesh_ptr));
if (ogs2metis_flag.getValue()) std::string const output_file_name_wo_extension = BaseLib::joinPaths(
output_directory_arg.getValue(),
BaseLib::extractBaseNameWithoutExtension(mesh_input.getValue()));
const int num_partitions = nparts.getValue();
if (num_partitions < 1)
{ {
INFO("Write the mesh into METIS input file."); OGS_FATAL("Number of partitions must be positive.");
mesh_partitioner.writeMETIS(BaseLib::dropFileExtension(ifile_name) +
".mesh");
} }
else
if (num_partitions == 1)
{ {
const int num_partitions = nparts.getValue(); OGS_FATAL(
"Partitioning the mesh into one domain is unnecessary because OGS "
"reads vtu mesh data directly when called with 'mpirun bin/ogs "
"-np=1'.");
}
// Execute mpmetis via system(...) // Execute mpmetis via system(...)
if (num_partitions > 1 && exe_metis_flag.getValue()) if (exe_metis_flag.getValue())
{ {
INFO("METIS is running ..."); INFO("METIS is running ...");
const std::string exe_name = argv[0]; const std::string exe_name = argv[0];
const std::string exe_path = BaseLib::extractPath(exe_name); const std::string exe_path = BaseLib::extractPath(exe_name);
INFO("Path to mpmetis is: \n\t%s", exe_path.c_str()); INFO("Path to mpmetis is: \n\t%s", exe_path.c_str());
const std::string mpmetis_com = const std::string mpmetis_com =
exe_path + "/mpmetis " + " -gtype=nodal " + file_name_base + BaseLib::joinPaths(exe_path, "mpmetis") + " -gtype=nodal " + "'" +
".mesh " + std::to_string(nparts.getValue()); input_file_name_wo_extension + ".mesh" + "' " +
std::to_string(nparts.getValue());
const int status = system(mpmetis_com.c_str());
if (status != 0) const int status = system(mpmetis_com.c_str());
{ if (status != 0)
INFO("Failed in system calling.");
INFO("Return value of system call %d ", status);
return EXIT_FAILURE;
}
}
else if (num_partitions == 1 && exe_metis_flag.getValue())
{ {
// The mpmetis tool can not be used for 'partitioning' in only one INFO("Failed in system calling.");
// domain. For this reason the according files are written for just INFO("Return value of system call %d ", status);
// one domain in the metis output format in the following. return EXIT_FAILURE;
auto writePartitionFile = [&file_name_base](
std::string const& file_name_extension, std::size_t number) {
std::string const name(file_name_base + file_name_extension);
std::ofstream os(name);
if (!os)
OGS_FATAL("Couldn't open file '%s' for writing.",
name.c_str());
for (std::size_t n(0); n < number; ++n)
os << "0\n";
};
writePartitionFile(".mesh.npart.1", number_of_nodes);
writePartitionFile(".mesh.epart.1", number_of_elements);
} }
}
mesh_partitioner.resetPartitionIdsForNodes(
readMetisData(input_file_name_wo_extension, num_partitions,
mesh_partitioner.mesh().getNumberOfNodes()));
mesh_partitioner.readMetisData(file_name_base); removeMetisPartitioningFiles(input_file_name_wo_extension, num_partitions);
INFO("Partitioning the mesh in the node wise way ..."); INFO("Partitioning the mesh in the node wise way ...");
mesh_partitioner.partitionByMETIS(lh_elems_flag.getValue()); mesh_partitioner.partitionByMETIS(lh_elems_flag.getValue());
if (ascii_flag.getValue()) if (ascii_flag.getValue())
{ {
INFO("Write the data of partitions into ASCII files ..."); INFO("Write the data of partitions into ASCII files ...");
mesh_partitioner.writeASCII(file_name_base); mesh_partitioner.writeASCII(output_file_name_wo_extension);
} }
else else
{ {
INFO("Write the data of partitions into binary files ..."); INFO("Write the data of partitions into binary files ...");
mesh_partitioner.writeBinary(file_name_base); mesh_partitioner.writeBinary(output_file_name_wo_extension);
}
} }
INFO("Total runtime: %g s.", run_timer.elapsed()); INFO("Total runtime: %g s.", run_timer.elapsed());
......
...@@ -39,3 +39,36 @@ AddTest( ...@@ -39,3 +39,36 @@ AddTest(
DIFF_DATA DIFF_DATA
expected_post_single_joint_pcs_0_ts_1_t_1.000000.vtu post_single_joint_pcs_0_ts_1_t_1.000000.vtu u u 1e-14 1e-14 expected_post_single_joint_pcs_0_ts_1_t_1.000000.vtu post_single_joint_pcs_0_ts_1_t_1.000000.vtu u u 1e-14 1e-14
) )
# Mac is producing slightly different partitioning, so the results are not
# comparable.
AddTest(
NAME partmesh_2Dmesh_3partitions_ascii
PATH NodePartitionedMesh/partmesh_2Dmesh_3partitions
EXECUTABLE partmesh
EXECUTABLE_ARGS -a -m -n 3 -i 2Dmesh.vtu -o ${Data_BINARY_DIR}/NodePartitionedMesh/partmesh_2Dmesh_3partitions
REQUIREMENTS NOT (OGS_USE_MPI OR APPLE)
TESTER diff
DIFF_DATA 2Dmesh_partitioned_elems_3.msh
2Dmesh_partitioned_cfg3.msh
2Dmesh_partitioned_nodes_3.msh
)
# Mac is producing slightly different partitioning, so the results are not
# comparable.
AddTest(
NAME partmesh_2Dmesh_3partitions_binary
PATH NodePartitionedMesh/partmesh_2Dmesh_3partitions
EXECUTABLE partmesh
EXECUTABLE_ARGS -m -n 3 -i 2Dmesh.vtu -o ${Data_BINARY_DIR}/NodePartitionedMesh/partmesh_2Dmesh_3partitions
REQUIREMENTS NOT (OGS_USE_MPI OR APPLE)
TESTER diff
DIFF_DATA 2Dmesh_partitioned_node_properties_val3.bin
2Dmesh_partitioned_node_properties_cfg3.bin
2Dmesh_partitioned_msh_cfg3.bin
2Dmesh_partitioned_cell_properties_val3.bin
2Dmesh_partitioned_cell_properties_cfg3.bin
2Dmesh_partitioned_msh_ele_g3.bin
2Dmesh_partitioned_msh_ele3.bin
2Dmesh_partitioned_msh_nod3.bin
)
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include "FileTools.h" #include "FileTools.h"
#include "Error.h"
#include "StringTools.h" #include "StringTools.h"
#include <sys/stat.h> #include <sys/stat.h>
......
...@@ -38,7 +38,7 @@ bool IsFileExisting(const std::string &strFilename); ...@@ -38,7 +38,7 @@ bool IsFileExisting(const std::string &strFilename);
*/ */
template <typename T> void writeValueBinary(std::ostream &out, T const& val) template <typename T> void writeValueBinary(std::ostream &out, T const& val)
{ {
out.write(static_cast<const char*>(&val), sizeof(T)); out.write(reinterpret_cast<const char*>(&val), sizeof(T));
} }
template <typename T> template <typename T>
......
...@@ -119,8 +119,6 @@ if(NOT WIN32 AND OGS_BUILD_SWMM) ...@@ -119,8 +119,6 @@ if(NOT WIN32 AND OGS_BUILD_SWMM)
message(FATAL_ERROR "OGS_BUILD_SWMM requires Windows!") message(FATAL_ERROR "OGS_BUILD_SWMM requires Windows!")
endif() endif()
option(OGS_BUILD_METIS "Should metis and the partmesh util be built?" OFF)
option(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF) option(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF)
option(OGS_INSITU "Builds OGS with insitu visualization capabilities." OFF) option(OGS_INSITU "Builds OGS with insitu visualization capabilities." OFF)
......
...@@ -97,8 +97,7 @@ pipeline { ...@@ -97,8 +97,7 @@ pipeline {
'-DOGS_USE_PCH=OFF ' + // see #1992 '-DOGS_USE_PCH=OFF ' + // see #1992
'-DOGS_BUILD_GUI=ON ' + '-DOGS_BUILD_GUI=ON ' +
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_TESTS=OFF ' + '-DOGS_BUILD_TESTS=OFF '
'-DOGS_BUILD_METIS=ON '
keepDir = true keepDir = true
} }
build { } build { }
...@@ -169,7 +168,6 @@ pipeline { ...@@ -169,7 +168,6 @@ pipeline {
configure { configure {
cmakeOptions = cmakeOptions =
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_METIS=ON ' +
'-DBUILD_SHARED_LIBS=ON ' '-DBUILD_SHARED_LIBS=ON '
env = 'envinf1/cli.sh' env = 'envinf1/cli.sh'
} }
...@@ -202,7 +200,6 @@ pipeline { ...@@ -202,7 +200,6 @@ pipeline {
configure { configure {
cmakeOptions = cmakeOptions =
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_METIS=ON ' +
'-DBUILD_SHARED_LIBS=ON ' + '-DBUILD_SHARED_LIBS=ON ' +
'-DOGS_USE_PETSC=ON ' '-DOGS_USE_PETSC=ON '
env = 'envinf1/petsc.sh' env = 'envinf1/petsc.sh'
...@@ -254,8 +251,7 @@ pipeline { ...@@ -254,8 +251,7 @@ pipeline {
'-DOGS_BUILD_GUI=ON ' + '-DOGS_BUILD_GUI=ON ' +
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_TESTS=OFF ' + '-DOGS_BUILD_TESTS=OFF ' +
'-DOGS_BUILD_SWMM=ON ' + '-DOGS_BUILD_SWMM=ON '
'-DOGS_BUILD_METIS=ON '
keepDir = true keepDir = true
} }
build { } build { }
...@@ -290,7 +286,6 @@ pipeline { ...@@ -290,7 +286,6 @@ pipeline {
'-DOGS_DOWNLOAD_ADDITIONAL_CONTENT=ON ' + '-DOGS_DOWNLOAD_ADDITIONAL_CONTENT=ON ' +
'-DOGS_BUILD_GUI=ON ' + '-DOGS_BUILD_GUI=ON ' +
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_METIS=ON ' +
'-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" ' '-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" '
} }
build { build {
...@@ -400,7 +395,6 @@ pipeline { ...@@ -400,7 +395,6 @@ pipeline {
configure { configure {
cmakeOptions = cmakeOptions =
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_METIS=ON ' +
'-DBUILD_SHARED_LIBS=ON ' + '-DBUILD_SHARED_LIBS=ON ' +
'-DCMAKE_INSTALL_PREFIX=/global/apps/ogs/head/standard ' + '-DCMAKE_INSTALL_PREFIX=/global/apps/ogs/head/standard ' +
'-DOGS_MODULEFILE=/global/apps/modulefiles/ogs/head/standard ' + '-DOGS_MODULEFILE=/global/apps/modulefiles/ogs/head/standard ' +
...@@ -428,7 +422,6 @@ pipeline { ...@@ -428,7 +422,6 @@ pipeline {
cmakeOptions = cmakeOptions =
'-DOGS_USE_PETSC=ON ' + '-DOGS_USE_PETSC=ON ' +
'-DOGS_BUILD_UTILS=ON ' + '-DOGS_BUILD_UTILS=ON ' +
'-DOGS_BUILD_METIS=ON ' +
'-DBUILD_SHARED_LIBS=ON ' + '-DBUILD_SHARED_LIBS=ON ' +
'-DCMAKE_INSTALL_PREFIX=/global/apps/ogs/head/petsc ' + '-DCMAKE_INSTALL_PREFIX=/global/apps/ogs/head/petsc ' +
'-DOGS_MODULEFILE=/global/apps/modulefiles/ogs/head/petsc ' + '-DOGS_MODULEFILE=/global/apps/modulefiles/ogs/head/petsc ' +
......
...@@ -20,6 +20,16 @@ namespace MeshLib ...@@ -20,6 +20,16 @@ namespace MeshLib
enum class MeshItemType { Node, Edge, Face, Cell, IntegrationPoint }; enum class MeshItemType { Node, Edge, Face, Cell, IntegrationPoint };
/// Char array names for all of MeshItemType values.
static constexpr char const* mesh_item_type_strings[] = {
"node", "edge", "face", "cell", "integration_point"};
/// Returns a char array for a specific MeshItemType.
static constexpr char const* toString(const MeshItemType t)
{
return mesh_item_type_strings[static_cast<int>(t)];
}
std::ostream& operator<<(std::ostream& os, MeshItemType const& t); std::ostream& operator<<(std::ostream& os, MeshItemType const& t);
/// Spatial location description. /// Spatial location description.
......
This diff is collapsed.
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment