diff --git a/MeshLib/IO/XDMF/HdfData.cpp b/MeshLib/IO/XDMF/HdfData.cpp index dc0b6272af6f1332a5375ed02ec7b2cfd4ec1eee..be11135d6308e69eb0d81c92136cdce1b04daad2 100644 --- a/MeshLib/IO/XDMF/HdfData.cpp +++ b/MeshLib/IO/XDMF/HdfData.cpp @@ -43,11 +43,11 @@ static hid_t meshPropertyType2HdfType(MeshPropertyDataType const ogs_data_type) HdfData::HdfData(void const* data_start, std::size_t const size_partitioned_dim, std::size_t const size_tuple, std::string const& name, MeshPropertyDataType const mesh_property_data_type, - unsigned int const num_of_files) + unsigned int const n_files) : data_start(data_start), name(name) { auto const& partition_info = - getPartitionInfo(size_partitioned_dim, num_of_files); + getPartitionInfo(size_partitioned_dim, n_files); auto const& offset_partitioned_dim = partition_info.local_offset; offsets = {offset_partitioned_dim, 0}; diff --git a/MeshLib/IO/XDMF/HdfData.h b/MeshLib/IO/XDMF/HdfData.h index bc41db110b2f0d10a0b5b0fcb9b409c3f2d72f82..e29b4aea49c4fef4eabfbc7a5afb129addebc6ef 100644 --- a/MeshLib/IO/XDMF/HdfData.h +++ b/MeshLib/IO/XDMF/HdfData.h @@ -25,8 +25,7 @@ struct HdfData final { HdfData(void const* data_start, std::size_t size_partitioned_dim, std::size_t size_tuple, std::string const& name, - MeshPropertyDataType mesh_property_data_type, - unsigned int num_of_files); + MeshPropertyDataType mesh_property_data_type, unsigned int n_files); void const* data_start; std::vector<Hdf5DimType> data_space; std::vector<Hdf5DimType> offsets; diff --git a/MeshLib/IO/XDMF/HdfWriter.cpp b/MeshLib/IO/XDMF/HdfWriter.cpp index a4ba35cb9c8f6b7bb606396ac49799107c502464..d60d8e779f7f4be7e16f93a98e288e33e834b8b2 100644 --- a/MeshLib/IO/XDMF/HdfWriter.cpp +++ b/MeshLib/IO/XDMF/HdfWriter.cpp @@ -214,9 +214,9 @@ HdfWriter::HdfWriter(std::vector<MeshHdfData> meshes, std::filesystem::path const& filepath, bool const use_compression, bool const is_file_manager, - unsigned int const num_of_files) + unsigned int const n_files) : _hdf5_filepath(filepath), - _file(createFile(filepath, num_of_files)), + _file(createFile(filepath, n_files)), _meshes_group( H5Gcreate2(_file, "/meshes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)), _step_times{0}, // ToDo need to be initial time diff --git a/MeshLib/IO/XDMF/HdfWriter.h b/MeshLib/IO/XDMF/HdfWriter.h index a58c1f4bd4dca35ac1ee4f5033112d231418ddc2..94e055007dfbe2cd66c900e2b37eb5fcd3fdfeb7 100644 --- a/MeshLib/IO/XDMF/HdfWriter.h +++ b/MeshLib/IO/XDMF/HdfWriter.h @@ -43,15 +43,14 @@ public: * @param filepath absolute or relative filepath to the hdf5 file * @param use_compression if true gzip compression is enabled * @param is_file_manager True if process (in parallel execution) is - * @param num_of_files Number of outputfiles - * File_Manager + * @param n_files Number of output files */ HdfWriter(std::vector<MeshHdfData> meshes, unsigned long long initial_step, std::filesystem::path const& filepath, bool use_compression, bool is_file_manager, - unsigned int num_of_files); + unsigned int n_files); /** * \brief Writes attributes. The data * itself is hold by a structure outside of this class. The writer assumes diff --git a/MeshLib/IO/XDMF/XdmfData.cpp b/MeshLib/IO/XDMF/XdmfData.cpp index f2e2b3c9eef39c19e8153cb39e652e434b02f5e2..1750bf52c04cf10f15b893a7643febf6fc4648ab 100644 --- a/MeshLib/IO/XDMF/XdmfData.cpp +++ b/MeshLib/IO/XDMF/XdmfData.cpp @@ -24,7 +24,7 @@ XdmfData::XdmfData(std::size_t const size_partitioned_dim, std::string const& name, std::optional<MeshLib::MeshItemType> const attribute_center, unsigned int const index, - unsigned int const num_of_files) + unsigned int const n_files) : starts( [&size_tuple]() { @@ -54,7 +54,7 @@ XdmfData::XdmfData(std::size_t const size_partitioned_dim, attribute_center(attribute_center), index(index) { - auto partition_info = getPartitionInfo(size_partitioned_dim, num_of_files); + auto partition_info = getPartitionInfo(size_partitioned_dim, n_files); // TODO (tm) XdmfLib does not support 64 bit data types so far assert(partition_info.local_length < std::numeric_limits<unsigned int>::max()); diff --git a/MeshLib/IO/XDMF/XdmfData.h b/MeshLib/IO/XDMF/XdmfData.h index d3a96f11d261c8294273b24ad06735195e3f03bc..3d8e67780b127e7ed580be62c5e357a8ea212c7a 100644 --- a/MeshLib/IO/XDMF/XdmfData.h +++ b/MeshLib/IO/XDMF/XdmfData.h @@ -46,15 +46,15 @@ struct XdmfData final * @param index The position of the DataItem parents in a grid * (representing a single step). Convention is: 1=Time, 2= * Geometry, 3=Topology, 4>=Attribute - * @param num_of_files If greater than 1 it groups the data of each process. - * The num_of_files specifies the number of groups + * @param n_files specifies the number of files. If greater than 1 it groups + * the data of each process to n_files * */ XdmfData(std::size_t size_partitioned_dim, std::size_t size_tuple, MeshPropertyDataType mesh_property_data_type, std::string const& name, std::optional<MeshLib::MeshItemType> attribute_center, - unsigned int const index, unsigned int num_of_files); + unsigned int const index, unsigned int n_files); // a hyperslab is defined by starts and strides see // https://www.xdmf.org/index.php/XDMF_Model_and_Format#HyperSlab std::vector<XdmfDimType> starts; diff --git a/MeshLib/IO/XDMF/XdmfHdfWriter.cpp b/MeshLib/IO/XDMF/XdmfHdfWriter.cpp index 265a639422550ce3f4938d67c8dd7ba2894e9d12..63fec5feb4cf8d91bfbcdbf7c57ef796cb7e3ff7 100644 --- a/MeshLib/IO/XDMF/XdmfHdfWriter.cpp +++ b/MeshLib/IO/XDMF/XdmfHdfWriter.cpp @@ -39,7 +39,7 @@ XdmfHdfWriter::XdmfHdfWriter( std::filesystem::path const& filepath, unsigned long long const time_step, double const initial_time, std::set<std::string> const& variable_output_names, - bool const use_compression, unsigned int const num_of_files) + bool const use_compression, unsigned int const n_files) { // ogs meshes to vector of Xdmf/HDF meshes (we keep Xdmf and HDF together // because XDMF depends on HDF) to meta @@ -79,12 +79,12 @@ XdmfHdfWriter::XdmfHdfWriter( // Transform the data to be written into a format conforming with the rules // of xdmf topology and geometry auto const transform_ogs_mesh_data_to_xdmf_conforming_data = - [&num_of_files](auto const& mesh) + [&n_files](auto const& mesh) { auto flattened_geometry_values = transformToXDMFGeometry(mesh); // actually this line is only needed to calculate the offset - XdmfHdfData const& geometry = transformGeometry( - mesh, flattened_geometry_values.data(), num_of_files); + XdmfHdfData const& geometry = + transformGeometry(mesh, flattened_geometry_values.data(), n_files); auto const flattened_topology_values = transformToXDMFTopology(mesh, geometry.hdf.offsets[0]); return std::make_unique<TransformedMeshData>( @@ -95,7 +95,7 @@ XdmfHdfWriter::XdmfHdfWriter( // create metadata for transformed data and original ogs mesh data auto const transform_to_meta_data = [&transform_ogs_mesh_data_to_xdmf_conforming_data, - &num_of_files](auto const& mesh) + &n_files](auto const& mesh) { // important: transformed data must survive and be unique, raw pointer // to its memory! @@ -103,10 +103,10 @@ XdmfHdfWriter::XdmfHdfWriter( transform_ogs_mesh_data_to_xdmf_conforming_data(mesh); auto const geometry = transformGeometry( mesh, xdmf_conforming_data->flattened_geometry_values.data(), - num_of_files); + n_files); auto const topology = transformTopology( - xdmf_conforming_data->flattened_topology_values, num_of_files); - auto const attributes = transformAttributes(mesh, num_of_files); + xdmf_conforming_data->flattened_topology_values, n_files); + auto const attributes = transformAttributes(mesh, n_files); return XdmfHdfMesh{std::move(geometry), std::move(topology), std::move(attributes), mesh.get().getName(), std::move(xdmf_conforming_data)}; @@ -159,7 +159,7 @@ XdmfHdfWriter::XdmfHdfWriter( auto const is_file_manager = isFileManager(); _hdf_writer = std::make_unique<HdfWriter>(std::move(hdf_meshes), time_step, hdf_filepath, use_compression, - is_file_manager, num_of_files); + is_file_manager, n_files); // --------------- XDMF --------------------- // The light data is only written by just one process diff --git a/MeshLib/IO/XDMF/XdmfHdfWriter.h b/MeshLib/IO/XDMF/XdmfHdfWriter.h index bdb3b884ec3c1bd733dc6421422095ce09712c6c..0fa6c2039814c088b5b5564e6449e0477dde36d7 100644 --- a/MeshLib/IO/XDMF/XdmfHdfWriter.h +++ b/MeshLib/IO/XDMF/XdmfHdfWriter.h @@ -36,13 +36,13 @@ public: * that change over time * @param use_compression if true, zlib compression in HDFWriter component * is used - * @param num_of_files number of hdf5 output files + * @param n_files number of hdf5 output files */ XdmfHdfWriter( std::vector<std::reference_wrapper<const MeshLib::Mesh>> meshes, std::filesystem::path const& filepath, unsigned long long time_step, double initial_time, std::set<std::string> const& variable_output_names, - bool use_compression, unsigned int num_of_files); + bool use_compression, unsigned int n_files); /** * \brief Adds data for either lazy (xdmf) or eager (hdf) writing algorithm diff --git a/MeshLib/IO/XDMF/fileIO.h b/MeshLib/IO/XDMF/fileIO.h index 1e03fafa175c1b474b831faed32ca5ad24914925..8bd4d5a474c5cfc05589eeecdd4cff97703983ce 100644 --- a/MeshLib/IO/XDMF/fileIO.h +++ b/MeshLib/IO/XDMF/fileIO.h @@ -18,9 +18,8 @@ namespace MeshLib::IO { -int64_t createFile(std::filesystem::path const& filepath, - unsigned int num_of_files); +int64_t createFile(std::filesystem::path const& filepath, unsigned int n_files); int64_t openHDF5File(std::filesystem::path const& filepath, - unsigned int num_of_files); + unsigned int n_files); int64_t createHDF5TransferPolicy(); } // namespace MeshLib::IO diff --git a/MeshLib/IO/XDMF/mpi/fileIO.cpp b/MeshLib/IO/XDMF/mpi/fileIO.cpp index 6e1343056508108386a98ec75991c00d82cd470b..4a81d6e6cdfc42b37b2505cf03f919d04b14f28c 100644 --- a/MeshLib/IO/XDMF/mpi/fileIO.cpp +++ b/MeshLib/IO/XDMF/mpi/fileIO.cpp @@ -23,7 +23,7 @@ using namespace std::string_literals; namespace MeshLib::IO { std::filesystem::path partitionFilename( - std::filesystem::path const& basic_filepath, int file_group) + std::filesystem::path const& basic_filepath, int const file_group) { std::string const filename = (file_group > 0) ? basic_filepath.stem().string() + "_"s + @@ -37,9 +37,9 @@ std::filesystem::path partitionFilename( }; hid_t createFile(std::filesystem::path const& filepath, - unsigned int const num_of_files) + unsigned int const n_files) { - auto const communicator = getCommunicator(num_of_files); + auto const communicator = getCommunicator(n_files); MPI_Comm const comm = communicator.mpi_communicator; MPI_Info const info = MPI_INFO_NULL; hid_t const plist_id = H5Pcreate(H5P_FILE_ACCESS); @@ -55,9 +55,9 @@ hid_t createFile(std::filesystem::path const& filepath, } hid_t openHDF5File(std::filesystem::path const& filepath, - unsigned int const num_of_files) + unsigned int const n_files) { - MPI_Comm const comm = getCommunicator(num_of_files).mpi_communicator; + MPI_Comm const comm = getCommunicator(n_files).mpi_communicator; MPI_Info info = MPI_INFO_NULL; hid_t const plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); diff --git a/MeshLib/IO/XDMF/mpi/getCommunicator.cpp b/MeshLib/IO/XDMF/mpi/getCommunicator.cpp index c6ac67395e772e63d9c29308e7be8336a80f759c..1942367b0cfe0658484eac2668fcf162ee490bab 100644 --- a/MeshLib/IO/XDMF/mpi/getCommunicator.cpp +++ b/MeshLib/IO/XDMF/mpi/getCommunicator.cpp @@ -32,21 +32,21 @@ int getGroupIndex(int const input_index, int const input_size, // A grouping algorithm that determines the number of groups and return the // group idx of the specified input_index assert(input_size >= new_group_size); - int const minimal_output_group_size = + int const minimum_output_group_size = std::lround(input_size / new_group_size); - int const maximal_output_group_size = (input_size % new_group_size) - ? minimal_output_group_size + 1 - : minimal_output_group_size; - return std::lround(input_index / maximal_output_group_size); + int const maximum_output_group_size = (input_size % new_group_size) + ? minimum_output_group_size + 1 + : minimum_output_group_size; + return std::lround(input_index / maximum_output_group_size); }; -FileCommunicator getCommunicator(unsigned int const num_of_files) +FileCommunicator getCommunicator(unsigned int const n_files) { int num_procs; MPI_Comm_size(MPI_COMM_WORLD, &num_procs); int rank_id; MPI_Comm_rank(MPI_COMM_WORLD, &rank_id); - int file_group_id = getGroupIndex(rank_id, num_procs, num_of_files); + int const file_group_id = getGroupIndex(rank_id, num_procs, n_files); MPI_Comm new_communicator; MPI_Comm_split(MPI_COMM_WORLD, file_group_id, rank_id, &new_communicator); return FileCommunicator{std::move(new_communicator), diff --git a/MeshLib/IO/XDMF/mpi/getCommunicator.h b/MeshLib/IO/XDMF/mpi/getCommunicator.h index 416b59ec2a62e0f0c40703bca0e042ea8c67375b..8438fcbfe4a88a663670149af1c0d0907c9147b7 100644 --- a/MeshLib/IO/XDMF/mpi/getCommunicator.h +++ b/MeshLib/IO/XDMF/mpi/getCommunicator.h @@ -1,3 +1,17 @@ +/** + * \file + * \author Tobias Meisel + * \date 2021-09-14 + * \brief Assigns to each MPI communicator an output file name by attribute + * color There are multiple implementation to this interface! + * \copyright + * Copyright (c) 2012-2021, 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 <mpi.h> @@ -12,5 +26,5 @@ struct FileCommunicator final int color; std::filesystem::path output_filename; }; -FileCommunicator getCommunicator(unsigned int num_of_files); +FileCommunicator getCommunicator(unsigned int n_files); } // namespace MeshLib::IO \ No newline at end of file diff --git a/MeshLib/IO/XDMF/mpi/partition.cpp b/MeshLib/IO/XDMF/mpi/partition.cpp index 67e0e5791faa1d01260ce9e9711cd704261f5664..63762ca8432ec5686b6283579bb40b7e6668a524 100644 --- a/MeshLib/IO/XDMF/mpi/partition.cpp +++ b/MeshLib/IO/XDMF/mpi/partition.cpp @@ -31,9 +31,9 @@ bool isFileManager() } PartitionInfo getPartitionInfo(std::size_t const size, - unsigned int const num_of_files) + unsigned int const n_files) { - MPI_Comm const mpi_comm = getCommunicator(num_of_files).mpi_communicator; + MPI_Comm const mpi_comm = getCommunicator(n_files).mpi_communicator; int mpi_size; int mpi_rank; MPI_Comm_size(mpi_comm, &mpi_size); diff --git a/MeshLib/IO/XDMF/partition.h b/MeshLib/IO/XDMF/partition.h index afb2cb8134d91eda895581513af5ef5988c0a7de..40b93a807acecec2837a2f978cf0d08ae702948f 100644 --- a/MeshLib/IO/XDMF/partition.h +++ b/MeshLib/IO/XDMF/partition.h @@ -25,6 +25,6 @@ struct PartitionInfo }; PartitionInfo getPartitionInfo(std::size_t const size, - unsigned int const num_of_files); + unsigned int const n_files); bool isFileManager(); } // namespace MeshLib::IO diff --git a/MeshLib/IO/XDMF/transformData.cpp b/MeshLib/IO/XDMF/transformData.cpp index c2bb18dfee53cbd48a6d32567d71c5164207ac89..2dec8a94547fa034c2faf1dc3532518dece58ec4 100644 --- a/MeshLib/IO/XDMF/transformData.cpp +++ b/MeshLib/IO/XDMF/transformData.cpp @@ -71,7 +71,7 @@ constexpr auto cellTypeOGS2XDMF(MeshLib::CellType const& cell_type) std::optional<XdmfHdfData> transformAttribute( std::pair<std::string, PropertyVectorBase*> const& property_pair, - unsigned int const num_of_files) + unsigned int const n_files) { // 3 data that will be captured and written by lambda f below MeshPropertyDataType data_type = MeshPropertyDataType::unknown; @@ -192,17 +192,17 @@ std::optional<XdmfHdfData> transformAttribute( std::string const& name = property_base->getPropertyName(); HdfData hdf = {data_ptr, num_of_tuples, ui_global_components, - name, data_type, num_of_files}; + name, data_type, n_files}; XdmfData xdmf = {num_of_tuples, ui_global_components, data_type, name, mesh_item_type, 0, - num_of_files}; + n_files}; return XdmfHdfData{std::move(hdf), std::move(xdmf)}; } std::vector<XdmfHdfData> transformAttributes(MeshLib::Mesh const& mesh, - unsigned int const num_of_files) + unsigned int const n_files) { MeshLib::Properties const& properties = mesh.getProperties(); @@ -216,8 +216,8 @@ std::vector<XdmfHdfData> transformAttributes(MeshLib::Mesh const& mesh, continue; } - if (auto const attribute = transformAttribute( - std::pair(name, property_base), num_of_files)) + if (auto const attribute = + transformAttribute(std::pair(name, property_base), n_files)) { attributes.push_back(attribute.value()); } @@ -247,7 +247,7 @@ std::vector<double> transformToXDMFGeometry(MeshLib::Mesh const& mesh) XdmfHdfData transformGeometry(MeshLib::Mesh const& mesh, double const* data_ptr, - unsigned int const num_of_files) + unsigned int const n_files) { std::string const name = "geometry"; std::vector<MeshLib::Node*> const& nodes = mesh.getNodes(); @@ -260,11 +260,11 @@ XdmfHdfData transformGeometry(MeshLib::Mesh const& mesh, point_size, name, MeshPropertyDataType::float64, - num_of_files}; + n_files}; XdmfData const xdmf = { partition_dim, point_size, MeshPropertyDataType::float64, name, std::nullopt, 2, - num_of_files}; + n_files}; return XdmfHdfData{std::move(hdf), std::move(xdmf)}; } @@ -297,15 +297,15 @@ std::vector<int> transformToXDMFTopology(MeshLib::Mesh const& mesh, } XdmfHdfData transformTopology(std::vector<int> const& values, - unsigned int const num_of_files) + unsigned int const n_files) { std::string const name = "topology"; HdfData const hdf = { values.data(), values.size(), 1, name, MeshPropertyDataType::int32, - num_of_files}; + n_files}; XdmfData const xdmf = { values.size(), 1, MeshPropertyDataType::int32, name, std::nullopt, 3, - num_of_files}; + n_files}; return XdmfHdfData{std::move(hdf), std::move(xdmf)}; } diff --git a/MeshLib/IO/XDMF/transformData.h b/MeshLib/IO/XDMF/transformData.h index 8c0e789cd5f839cde13b59c20dee588deb2caa1a..af3a09e7c61a29bbf83dd327270b64caea1bf14e 100644 --- a/MeshLib/IO/XDMF/transformData.h +++ b/MeshLib/IO/XDMF/transformData.h @@ -26,31 +26,31 @@ namespace MeshLib::IO /** * \brief Create meta data for attributes used for hdf5 and xdmf * @param mesh OGS mesh can be mesh or partitionedMesh - * @param num_of_files If greater than 1 it groups the data of each process. The - * num_of_files specifies the number of groups + * @param n_files specifies the number of files. If greater than 1 it groups the + * data of each process to n_files * @return vector of meta data */ std::vector<XdmfHdfData> transformAttributes(MeshLib::Mesh const& mesh, - unsigned int num_of_files); + unsigned int n_files); /** * \brief Create meta data for geometry used for hdf5 and xdmf * @param mesh OGS mesh can be mesh or partitionedMesh * @param data_ptr Memory location of geometry values. - * @param num_of_files If greater than 1 it groups the data of each process. The - * num_of_files specifies the number of groups + * @param n_files specifies the number of files. If greater than 1 it groups the + * data of each process to n_files * @return Geometry meta data */ XdmfHdfData transformGeometry(MeshLib::Mesh const& mesh, double const* data_ptr, - unsigned int num_of_files); + unsigned int n_files); /** * \brief Create meta data for topology used for HDF5 and XDMF * @param values actual topology values to get size and memory location - * @param num_of_files If greater than 1 it groups the data of each process. The - * num_of_files specifies the number of groups + * @param n_files specifies the number of files. If greater than 1 it groups the + * data of each process to n_files * @return Topology meta data */ XdmfHdfData transformTopology(std::vector<int> const& values, - unsigned int num_of_files); + unsigned int n_files); /** * \brief Copies all node points into a new vector. Contiguous data used for * writing. Conform with XDMF standard in diff --git a/ProcessLib/Output/Output.cpp b/ProcessLib/Output/Output.cpp index 6a6f80c6f6f548dbcf8211789d69e5cdb90d6cd1..0171f2cebdad7b7db072436cc43ecc39bf4344fb 100644 --- a/ProcessLib/Output/Output.cpp +++ b/ProcessLib/Output/Output.cpp @@ -95,7 +95,7 @@ bool Output::shallDoOutput(int timestep, double const t) Output::Output(std::string directory, OutputType file_type, std::string file_prefix, std::string file_suffix, - bool const compress_output, unsigned int const num_of_files, + bool const compress_output, unsigned int const n_files, std::string const& data_mode, bool const output_nonlinear_iteration_results, std::vector<PairRepeatEachSteps> repeats_each_steps, @@ -108,7 +108,7 @@ Output::Output(std::string directory, OutputType file_type, _output_file_prefix(std::move(file_prefix)), _output_file_suffix(std::move(file_suffix)), _output_file_compression(compress_output), - _num_of_files(num_of_files), + _n_files(n_files), _output_file_data_mode(convertVtkDataMode(data_mode)), _output_nonlinear_iteration_results(output_nonlinear_iteration_results), _repeats_each_steps(std::move(repeats_each_steps)), @@ -183,7 +183,7 @@ struct Output::OutputFile int const iteration, int const data_mode_, bool const compression_, std::set<std::string> const& outputnames, - unsigned int const num_of_files) + unsigned int const n_files) : name(constructFilename(type, prefix, suffix, mesh_name, timestep, t, iteration)), path(BaseLib::joinPaths(directory, name)), @@ -191,7 +191,7 @@ struct Output::OutputFile data_mode(data_mode_), compression(compression_), outputnames(outputnames), - num_of_files(num_of_files) + n_files(n_files) { } @@ -206,7 +206,7 @@ struct Output::OutputFile //! Enables or disables zlib-compression of the output files. bool const compression; std::set<std::string> outputnames; - unsigned int num_of_files; + unsigned int n_files; static std::string constructFilename(OutputType const type, std::string prefix, std::string suffix, std::string mesh_name, @@ -250,7 +250,7 @@ void Output::outputMeshXdmf( _mesh_xdmf_hdf_writer = std::make_unique<MeshLib::IO::XdmfHdfWriter>( std::move(meshes), path, timestep, t, _output_data_specification.output_variables, - output_file.compression, output_file.num_of_files); + output_file.compression, output_file.n_files); } else { @@ -337,7 +337,7 @@ void Output::doOutputAlways(Process const& process, _output_directory, _output_file_type, _output_file_prefix, "", name, timestep, t, iteration, _output_file_data_mode, _output_file_compression, - _output_data_specification.output_variables, _num_of_files); + _output_data_specification.output_variables, _n_files); outputMeshXdmf(std::move(file), std::move(meshes), timestep, t); } diff --git a/ProcessLib/Output/Output.h b/ProcessLib/Output/Output.h index 075f9f98241eb3470a7252ef8147c0f805e80ae3..47a5c155d657452f29861efdde32068d1baaaa18 100644 --- a/ProcessLib/Output/Output.h +++ b/ProcessLib/Output/Output.h @@ -39,8 +39,8 @@ public: public: Output(std::string directory, OutputType const type, std::string prefix, - std::string suffix, bool const compress_output, - unsigned int num_of_files, std::string const& data_mode, + std::string suffix, bool const compress_output, unsigned int n_files, + std::string const& data_mode, bool const output_nonlinear_iteration_results, std::vector<PairRepeatEachSteps> repeats_each_steps, std::vector<double>&& fixed_output_times, @@ -109,7 +109,7 @@ private: //! Enables or disables zlib-compression of the output files. bool const _output_file_compression; //! Specifies the number of hdf5 output files. - unsigned int const _num_of_files; + unsigned int const _n_files; //! Chooses vtk's data mode for output following the enumeration given in /// the vtkXMLWriter: {Ascii, Binary, Appended}. See vtkXMLWriter diff --git a/ProcessLib/SteadyStateDiffusion/Tests.cmake b/ProcessLib/SteadyStateDiffusion/Tests.cmake index 8ca8c99f3c7a5f4bd818bbf76190fbf32d19b99f..7b3aae8928371bed305aaa872f7e69e114346e60 100644 --- a/ProcessLib/SteadyStateDiffusion/Tests.cmake +++ b/ProcessLib/SteadyStateDiffusion/Tests.cmake @@ -416,7 +416,7 @@ AddTest( ) AddTest( - NAME ParallelFEM_GroundWaterFlow3D_NeumannBC_XDMF_np3 + NAME ParallelFEM_GroundWaterFlow3D_NeumannBC_XDMF_np3_1file PATH EllipticPETSc EXECUTABLE ogs EXECUTABLE_ARGS cube_1e3_XDMF_np3.prj @@ -431,9 +431,9 @@ AddTest( AddTest( NAME ParallelFEM_GroundWaterFlow3D_NeumannBC_XDMF_np3_2files - PATH EllipticPETSc + PATH EllipticPETSc/XDMF_NP3_2 EXECUTABLE ogs - EXECUTABLE_ARGS cube_1e3_XDMF_np3_2files.prj + EXECUTABLE_ARGS ../cube_1e3_XDMF_np3_2files.prj WRAPPER mpirun WRAPPER_ARGS -np 3 TESTER xdmfdiff @@ -445,9 +445,9 @@ AddTest( AddTest( NAME ParallelFEM_GroundWaterFlow3D_NeumannBC_XDMF_np3_3files - PATH EllipticPETSc + PATH EllipticPETSc/XDMF_NP3_3 EXECUTABLE ogs - EXECUTABLE_ARGS cube_1e3_XDMF_np3_3files.prj + EXECUTABLE_ARGS ../cube_1e3_XDMF_np3_3files.prj WRAPPER mpirun WRAPPER_ARGS -np 3 TESTER xdmfdiff diff --git a/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.h5 b/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.h5 new file mode 100644 index 0000000000000000000000000000000000000000..f583bc7066a8b9a83ef1b73598b8310f09b2a6ed Binary files /dev/null and b/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.h5 differ diff --git a/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.xdmf b/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.xdmf new file mode 100644 index 0000000000000000000000000000000000000000..1dde252be3a970d123702b33dcac8110dbf28fd9 --- /dev/null +++ b/Tests/Data/EllipticPETSc/XDMF_NP3_2/cube_1e3_np3_2files_0.xdmf @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<Xdmf xmlns:xi="http://www.w3.org/2001/XInclude" Version="3.0"> +<Domain> +<Information Name="OGS_VERSION" Value="6.4.0-1101-g95b76f5387.dirty"/> +<Grid CollectionType="Temporal" GridType="Collection" Name="Collection"> +<Grid Name="Grid"> + <Time Value="0"/> + <Geometry Origin="" Type="XYZ"> + <DataItem DataType="Float" Dimensions="1265 3" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/geometry|0 0 0:1 1 1:1 1265 3:2 1265 3</DataItem> + </Geometry> + <Topology Dimensions="7344" Type="Mixed"> + <DataItem DataType="Int" Dimensions="7344" Format="HDF" Precision="4">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/topology|0 0:1 1:1 7344:2 7344</DataItem> + </Topology> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="D1_left_front_N1_right" Type="None"> + <DataItem DataType="Float" Dimensions="1265" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/D1_left_front_N1_right|0 0:1 1:1 1265:2 1265</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="Linear_1_to_minus1" Type="None"> + <DataItem DataType="Float" Dimensions="1265" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/Linear_1_to_minus1|0 0:1 1:1 1265:2 1265</DataItem> + </Attribute> + <Attribute Center="Cell" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="MaterialIDs" Type="None"> + <DataItem DataType="Int" Dimensions="816" Format="HDF" Precision="4">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/MaterialIDs|0 0:1 1:1 816:2 816</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="pressure" Type="None"> + <DataItem DataType="Float" Dimensions="1265" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/pressure|0 0:1 1:1 1265:2 1265</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="v" Type="None"> + <DataItem DataType="Float" Dimensions="1265 3" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/v|0 0 0:1 1 1:1 1265 3:2 1265 3</DataItem> + </Attribute> +</Grid> +<Grid Name="Grid"> + <Time Value="0.1"/> + <xi:include xpointer="element(/1/1/2/1/2)"/> + <xi:include xpointer="element(/1/1/2/1/3)"/> + <xi:include xpointer="element(/1/1/2/1/4)"/> + <xi:include xpointer="element(/1/1/2/1/5)"/> + <xi:include xpointer="element(/1/1/2/1/6)"/> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="pressure" Type="None"> + <DataItem DataType="Float" Dimensions="1265" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/pressure|1 0:1 1:1 1265:2 1265</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="v" Type="None"> + <DataItem DataType="Float" Dimensions="1265 3" Format="HDF" Precision="8">cube_1e3_np3_2files_0.h5:meshes/cube_1x1x1_hex_1e3/v|1 0 0:1 1 1:1 1265 3:2 1265 3</DataItem> + </Attribute> +</Grid> +</Grid> +</Domain> +</Xdmf> \ No newline at end of file diff --git a/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.h5 b/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.h5 new file mode 100644 index 0000000000000000000000000000000000000000..be8f04e16d212bc4cf2232ba6607793cadde824c Binary files /dev/null and b/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.h5 differ diff --git a/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.xdmf b/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.xdmf new file mode 100644 index 0000000000000000000000000000000000000000..fb3ea49426f0bbd3dcb5614a1417c97c47a9565f --- /dev/null +++ b/Tests/Data/EllipticPETSc/XDMF_NP3_3/cube_1e3_np3_3files_0.xdmf @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<Xdmf xmlns:xi="http://www.w3.org/2001/XInclude" Version="3.0"> +<Domain> +<Information Name="OGS_VERSION" Value="6.4.0-1101-g95b76f5387.dirty"/> +<Grid CollectionType="Temporal" GridType="Collection" Name="Collection"> +<Grid Name="Grid"> + <Time Value="0"/> + <Geometry Origin="" Type="XYZ"> + <DataItem DataType="Float" Dimensions="643 3" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/geometry|0 0 0:1 1 1:1 643 3:2 643 3</DataItem> + </Geometry> + <Topology Dimensions="3753" Type="Mixed"> + <DataItem DataType="Int" Dimensions="3753" Format="HDF" Precision="4">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/topology|0 0:1 1:1 3753:2 3753</DataItem> + </Topology> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="D1_left_front_N1_right" Type="None"> + <DataItem DataType="Float" Dimensions="643" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/D1_left_front_N1_right|0 0:1 1:1 643:2 643</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="Linear_1_to_minus1" Type="None"> + <DataItem DataType="Float" Dimensions="643" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/Linear_1_to_minus1|0 0:1 1:1 643:2 643</DataItem> + </Attribute> + <Attribute Center="Cell" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="MaterialIDs" Type="None"> + <DataItem DataType="Int" Dimensions="417" Format="HDF" Precision="4">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/MaterialIDs|0 0:1 1:1 417:2 417</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="pressure" Type="None"> + <DataItem DataType="Float" Dimensions="643" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/pressure|0 0:1 1:1 643:2 643</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="v" Type="None"> + <DataItem DataType="Float" Dimensions="643 3" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/v|0 0 0:1 1 1:1 643 3:2 643 3</DataItem> + </Attribute> +</Grid> +<Grid Name="Grid"> + <Time Value="0.1"/> + <xi:include xpointer="element(/1/1/2/1/2)"/> + <xi:include xpointer="element(/1/1/2/1/3)"/> + <xi:include xpointer="element(/1/1/2/1/4)"/> + <xi:include xpointer="element(/1/1/2/1/5)"/> + <xi:include xpointer="element(/1/1/2/1/6)"/> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="pressure" Type="None"> + <DataItem DataType="Float" Dimensions="643" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/pressure|1 0:1 1:1 643:2 643</DataItem> + </Attribute> + <Attribute Center="Node" ElementCell="" ElementDegree="0" ElementFamily="" ItemType="" Name="v" Type="None"> + <DataItem DataType="Float" Dimensions="643 3" Format="HDF" Precision="8">cube_1e3_np3_3files_0.h5:meshes/cube_1x1x1_hex_1e3/v|1 0 0:1 1 1:1 643 3:2 643 3</DataItem> + </Attribute> +</Grid> +</Grid> +</Domain> +</Xdmf> \ No newline at end of file diff --git a/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3.prj b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3.prj index 3fb3aef3a66e5fd5b1cdf8cd8e95de8d567f7714..eea6db0a3d6c15afa314da9c5a36c5b1ae76b3f4 100644 --- a/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3.prj +++ b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3.prj @@ -66,7 +66,7 @@ </variables> <suffix>_ts_{:timestep}_t_{:time}</suffix> <hdf> - <num_of_files>1</num_of_files> + <number_of_files>1</number_of_files> </hdf> </output> </time_loop> diff --git a/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_2files.prj b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_2files.prj new file mode 100644 index 0000000000000000000000000000000000000000..87ec030106216b19566d3a48d806574172f2d129 --- /dev/null +++ b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_2files.prj @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<OpenGeoSysProject> + <mesh>cube_1x1x1_hex_1e3.vtu</mesh> + <geometry>cube_1x1x1.gml</geometry> + <processes> + <process> + <name>GW23</name> + <type>STEADY_STATE_DIFFUSION</type> + <integration_order>2</integration_order> + <process_variables> + <process_variable>pressure</process_variable> + </process_variables> + <secondary_variables> + <secondary_variable internal_name="darcy_velocity" output_name="v"/> + </secondary_variables> + </process> + </processes> + <media> + <medium id="0"> + <phases/> + <properties> + <property> + <name>diffusion</name> + <type>Constant</type> + <value>1</value> + </property> + <property> + <name>reference_temperature</name> + <type>Constant</type> + <value>293.15</value> + </property> + </properties> + </medium> + </media> + <time_loop> + <processes> + <process ref="GW23"> + <nonlinear_solver>basic_picard</nonlinear_solver> + <convergence_criterion> + <type>DeltaX</type> + <norm_type>NORM2</norm_type> + <abstol>1.e-6</abstol> + </convergence_criterion> + <time_discretization> + <type>BackwardEuler</type> + </time_discretization> + <time_stepping> + <type>FixedTimeStepping</type> + <t_initial>0.0</t_initial> + <t_end>1e-1</t_end> + <timesteps> + <pair> + <repeat>1</repeat> + <delta_t>1e-1</delta_t> + </pair> + </timesteps> + </time_stepping> + </process> + </processes> + <output> + <type>XDMF</type> + <prefix>cube_1e3_np3</prefix> + <variables> + <variable> pressure </variable> + <variable> v </variable> + </variables> + <suffix>_ts_{:timestep}_t_{:time}</suffix> + <hdf> + <number_of_files>2</number_of_files> + </hdf> + </output> + </time_loop> + <parameters> + <parameter> + <name>p0</name> + <type>Constant</type> + <value>0</value> + </parameter> + <parameter> + <name>p_Dirichlet_left</name> + <type>Constant</type> + <value>1</value> + </parameter> + <parameter> + <name>p_Dirichlet_right</name> + <type>Constant</type> + <value>-1</value> + </parameter> + </parameters> + <process_variables> + <process_variable> + <name>pressure</name> + <components>1</components> + <order>1</order> + <initial_condition>p0</initial_condition> + <boundary_conditions> + <boundary_condition> + <geometrical_set>cube_1x1x1_geometry</geometrical_set> + <geometry>left</geometry> + <type>Dirichlet</type> + <parameter>p_Dirichlet_left</parameter> + </boundary_condition> + <boundary_condition> + <geometrical_set>cube_1x1x1_geometry</geometrical_set> + <geometry>right</geometry> + <type>Dirichlet</type> + <parameter>p_Dirichlet_right</parameter> + </boundary_condition> + </boundary_conditions> + </process_variable> + </process_variables> + <nonlinear_solvers> + <nonlinear_solver> + <name>basic_picard</name> + <type>Picard</type> + <max_iter>10</max_iter> + <linear_solver>general_linear_solver</linear_solver> + </nonlinear_solver> + </nonlinear_solvers> + <linear_solvers> + <linear_solver> + <name>general_linear_solver</name> + <lis>-i cg -p jacobi -tol 1e-16 -maxiter 10000</lis> + <eigen> + <solver_type>CG</solver_type> + <precon_type>DIAGONAL</precon_type> + <max_iteration_step>10000</max_iteration_step> + <error_tolerance>1e-16</error_tolerance> + </eigen> + <petsc> + <prefix>gw</prefix> + <parameters>-gw_ksp_type bcgs -gw_pc_type mg -gw_ksp_rtol 1.e-16 -gw_ksp_max_it 10000</parameters> + </petsc> + </linear_solver> + </linear_solvers> +</OpenGeoSysProject> diff --git a/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_3files.prj b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_3files.prj new file mode 100644 index 0000000000000000000000000000000000000000..470bf91b822936486ec30670edeeb4568b940537 --- /dev/null +++ b/Tests/Data/EllipticPETSc/cube_1e3_XDMF_np3_3files.prj @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<OpenGeoSysProject> + <mesh>cube_1x1x1_hex_1e3.vtu</mesh> + <geometry>cube_1x1x1.gml</geometry> + <processes> + <process> + <name>GW23</name> + <type>STEADY_STATE_DIFFUSION</type> + <integration_order>2</integration_order> + <process_variables> + <process_variable>pressure</process_variable> + </process_variables> + <secondary_variables> + <secondary_variable internal_name="darcy_velocity" output_name="v"/> + </secondary_variables> + </process> + </processes> + <media> + <medium id="0"> + <phases/> + <properties> + <property> + <name>diffusion</name> + <type>Constant</type> + <value>1</value> + </property> + <property> + <name>reference_temperature</name> + <type>Constant</type> + <value>293.15</value> + </property> + </properties> + </medium> + </media> + <time_loop> + <processes> + <process ref="GW23"> + <nonlinear_solver>basic_picard</nonlinear_solver> + <convergence_criterion> + <type>DeltaX</type> + <norm_type>NORM2</norm_type> + <abstol>1.e-6</abstol> + </convergence_criterion> + <time_discretization> + <type>BackwardEuler</type> + </time_discretization> + <time_stepping> + <type>FixedTimeStepping</type> + <t_initial>0.0</t_initial> + <t_end>1e-1</t_end> + <timesteps> + <pair> + <repeat>1</repeat> + <delta_t>1e-1</delta_t> + </pair> + </timesteps> + </time_stepping> + </process> + </processes> + <output> + <type>XDMF</type> + <prefix>cube_1e3_np3</prefix> + <variables> + <variable> pressure </variable> + <variable> v </variable> + </variables> + <suffix>_ts_{:timestep}_t_{:time}</suffix> + <hdf> + <number_of_files>3</number_of_files> + </hdf> + </output> + </time_loop> + <parameters> + <parameter> + <name>p0</name> + <type>Constant</type> + <value>0</value> + </parameter> + <parameter> + <name>p_Dirichlet_left</name> + <type>Constant</type> + <value>1</value> + </parameter> + <parameter> + <name>p_Dirichlet_right</name> + <type>Constant</type> + <value>-1</value> + </parameter> + </parameters> + <process_variables> + <process_variable> + <name>pressure</name> + <components>1</components> + <order>1</order> + <initial_condition>p0</initial_condition> + <boundary_conditions> + <boundary_condition> + <geometrical_set>cube_1x1x1_geometry</geometrical_set> + <geometry>left</geometry> + <type>Dirichlet</type> + <parameter>p_Dirichlet_left</parameter> + </boundary_condition> + <boundary_condition> + <geometrical_set>cube_1x1x1_geometry</geometrical_set> + <geometry>right</geometry> + <type>Dirichlet</type> + <parameter>p_Dirichlet_right</parameter> + </boundary_condition> + </boundary_conditions> + </process_variable> + </process_variables> + <nonlinear_solvers> + <nonlinear_solver> + <name>basic_picard</name> + <type>Picard</type> + <max_iter>10</max_iter> + <linear_solver>general_linear_solver</linear_solver> + </nonlinear_solver> + </nonlinear_solvers> + <linear_solvers> + <linear_solver> + <name>general_linear_solver</name> + <lis>-i cg -p jacobi -tol 1e-16 -maxiter 10000</lis> + <eigen> + <solver_type>CG</solver_type> + <precon_type>DIAGONAL</precon_type> + <max_iteration_step>10000</max_iteration_step> + <error_tolerance>1e-16</error_tolerance> + </eigen> + <petsc> + <prefix>gw</prefix> + <parameters>-gw_ksp_type bcgs -gw_pc_type mg -gw_ksp_rtol 1.e-16 -gw_ksp_max_it 10000</parameters> + </petsc> + </linear_solver> + </linear_solvers> +</OpenGeoSysProject>