Commit 20b44cd9 authored by Lars Bilke's avatar Lars Bilke

Fixed multiple compilation issues on MSVC.

parent 02eb0613
......@@ -100,10 +100,10 @@ Xdmf3Writer::Xdmf3Writer(std::filesystem::path const& filepath,
int const timestep)
: _attributes(std::move(attributes)),
_hdf5filepath(filepath.parent_path() /
(std::string(filepath.stem()) + ".h5"))
(filepath.stem().string() + ".h5"))
{
std::filesystem::path const xdmf_filepath =
filepath.parent_path() / (std::string(filepath.stem()) + ".xdmf");
filepath.parent_path() / (filepath.stem().string() + ".xdmf");
auto const ret_hdf5 = writeHDF5Initial(geometry.flattend_values,
geometry.vldims,
topology.flattend_values,
......@@ -113,11 +113,11 @@ Xdmf3Writer::Xdmf3Writer(std::filesystem::path const& filepath,
_use_compression = ret_hdf5.second;
_initial_geometry =
getLightGeometry(_hdf5filepath.filename(), timestep, geometry);
getLightGeometry(_hdf5filepath.filename().string(), timestep, geometry);
_initial_topology =
getLightTopology(_hdf5filepath.filename(), timestep, topology);
getLightTopology(_hdf5filepath.filename().string(), timestep, topology);
_writer = XdmfWriter::New(xdmf_filepath);
_writer = XdmfWriter::New(xdmf_filepath.string());
_writer->setMode(XdmfWriter::DistributedHeavyData);
auto version = XdmfInformation::New();
......@@ -149,7 +149,7 @@ void Xdmf3Writer::writeStep(int const time_step, double const time)
attribute.data_type,
_use_compression);
grid->insert(
getLightAttribute(_hdf5filepath.filename(), time_step, attribute));
getLightAttribute(_hdf5filepath.filename().string(), time_step, attribute));
}
auto gridcollection = _root->getGridCollection(0);
......
......@@ -8,13 +8,16 @@
*/
// \TODO (tm) Extend xdmf lib with 64bit datatypes
#if !_MSC_VER
#pragma GCC diagnostic ignored "-Wnarrowing"
#endif
#include "transformData.h"
#include <XdmfArrayType.hpp>
#include <XdmfAttributeCenter.hpp>
#include <XdmfTopologyType.hpp>
#include <optional>
#include <variant>
#include "InfoLib/GitInfo.h"
......@@ -103,8 +106,8 @@ std::optional<AttributeMeta> transformAttribute(
auto const global_components =
property_base->getNumberOfGlobalComponents();
auto const size = typed_property->getNumberOfTuples();
auto const vdims = [](auto num_components,
auto size) -> std::vector<XdmfDimType> {
auto const vdims = [](XdmfDimType num_components,
XdmfDimType size) -> std::vector<XdmfDimType> {
if (num_components > 1)
{
return {size, num_components};
......@@ -115,8 +118,8 @@ std::optional<AttributeMeta> transformAttribute(
// \TODO (tm) Remove code duplicationby eliminating the need for a
// second vldim at all by modification of XdmfHdf5Controller
// taking unsigned long long
auto const vldims = [](auto num_components,
auto size) -> std::vector<Hdf5DimType> {
auto const vldims = [](XdmfDimType num_components,
XdmfDimType size) -> std::vector<Hdf5DimType> {
if (num_components > 1)
{
return std::vector<Hdf5DimType>{size, num_components};
......@@ -151,25 +154,26 @@ std::optional<AttributeMeta> transformAttribute(
"Signed int has 32-1 bits");
data_type = XdmfArrayType::Int32();
}
else if constexpr (std::is_same_v<long, decltype(basic_type)>)
{
static_assert((std::numeric_limits<long>::digits == 63),
"Signed int has 64-1 bits");
data_type = XdmfArrayType::Int64();
}
// \TODO (tm) Reimplement size checks
// else if constexpr (std::is_same_v<long, decltype(basic_type)>)
// {
// static_assert((std::numeric_limits<long>::digits == 63),
// "Signed int has 64-1 bits");
// data_type = XdmfArrayType::Int64();
// }
else if constexpr (std::is_same_v<unsigned int, decltype(basic_type)>)
{
static_assert((std::numeric_limits<unsigned int>::digits == 32),
"Unsigned int has 32 bits");
data_type = XdmfArrayType::UInt32();
}
else if constexpr (std::is_same_v<unsigned long, decltype(basic_type)>)
{
static_assert((std::numeric_limits<unsigned long>::digits == 64),
"UnSigned long has 64 bits");
// \TODO (tm) Extend XdmfLibrary with 64bit datatypes
data_type = XdmfArrayType::UInt32();
}
// else if constexpr (std::is_same_v<unsigned long, decltype(basic_type)>)
// {
// static_assert((std::numeric_limits<unsigned long>::digits == 64),
// "Unsigned long has 64 bits");
// // \TODO (tm) Extend XdmfLibrary with 64bit datatypes
// data_type = XdmfArrayType::UInt32();
// }
else if constexpr (std::is_same_v<std::size_t, decltype(basic_type)>)
{
static_assert((std::numeric_limits<std::size_t>::digits == 64),
......@@ -264,7 +268,7 @@ Geometry transformGeometry(MeshLib::Mesh const& mesh)
values.insert(values.cend(), x, x + 3);
}
std::vector<XdmfDimType> const vdims = {nodes.size(), 3};
std::vector<XdmfDimType> const vdims = {static_cast<XdmfDimType>(nodes.size()), 3};
std::vector<Hdf5DimType> const vldims = {nodes.size(), 3};
std::vector<XdmfDimType> const starts = {0, 0, 0};
std::vector<XdmfDimType> const strides = {1, 1, 1};
......@@ -297,9 +301,9 @@ Topology transformTopology(MeshLib::Mesh const& mesh)
std::vector<XdmfDimType> const starts = {0};
std::vector<XdmfDimType> const strides = {1};
std::vector<XdmfDimType> const vdims = {values.size()};
std::vector<XdmfDimType> const vdims = {static_cast<XdmfDimType>(values.size())};
std::vector<Hdf5DimType> const vldims = {values.size()};
return Topology{std::move(values), starts, strides, vdims, vldims};
}
} // namespace MeshLib::IO
\ No newline at end of file
} // namespace MeshLib::IO
......@@ -56,7 +56,7 @@ int writeHDF5Step(std::filesystem::path const& filepath, int const step,
{
// \TODO (tm) Errhandling, not implemented as we will change from CAPI to
// C++API negative value is failure
hid_t file = H5Fopen(filepath.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
hid_t file = H5Fopen(filepath.string().c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
std::string const time_section = getTimeSection(step);
......@@ -145,7 +145,7 @@ std::pair<int, bool> writeHDF5Initial(
hid_t topology_space = H5Screate_simple(1, topology_dims, nullptr);
{
hid_t file = H5Fcreate(filepath.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT,
hid_t file = H5Fcreate(filepath.string().c_str(), H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
std::string const time_section = getTimeSection(step);
hid_t group_id = H5Gcreate2(file, time_section.c_str(), H5P_DEFAULT,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment