Files
ResInsight/ApplicationLibCode/FileInterface/RifVtkImportUtil.h
T
Kristian Bendiksen cdf4e0fa64 VTK: read only scalar point data arrays as node properties
Vector arrays such as "disp" are read by readDisplacements and were
parsed again only to be discarded by readNodalData.
2026-10-24 13:59:38 +02:00

55 lines
2.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <filesystem>
#include <map>
#include <string>
#include <vector>
#include "cvfVector3.h"
#include "pugixml.hpp"
//==================================================================================================
///
//==================================================================================================
class RifVtkImportUtil
{
public:
struct PvdDataset
{
double timestep;
std::filesystem::path filepath;
};
static std::vector<PvdDataset> parsePvdDatasets( const std::filesystem::path& filepath );
static std::vector<cvf::Vec3d> readPoints( const pugi::xml_node& piece );
static std::vector<cvf::Vec3f> readDisplacements( const pugi::xml_node& piece );
static std::vector<unsigned> readConnectivity( const pugi::xml_node& piece );
static std::map<std::string, std::vector<float>> readProperties( const pugi::xml_node& piece );
static std::map<std::string, std::vector<float>> readPointProperties( const pugi::xml_node& piece );
private:
static std::map<std::string, std::vector<float>> readDataArrays( const pugi::xml_node& data, bool scalarsOnly );
static std::vector<cvf::Vec3d> parseVec3ds( std::string_view text );
static std::vector<cvf::Vec3f> parseVec3fs( std::string_view text );
};