Peano
Loading...
Searching...
No Matches
PeanoTextPatchFileReader.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <iosfwd>
6#include <string>
7#include <vector>
8
9namespace tarch {
10 namespace reader {
11 class PeanoTextPatchFileReader;
12 } // namespace reader
13} // namespace tarch
14
15
41 public:
42 enum class Format {
43 ASCII,
44 Binary
45 };
46
50 struct Header {
52 int dimensions = -1;
53 };
54
58 struct Patch {
63 std::vector<double> offset;
64 std::vector<double> size;
65
70
75
79 std::vector<double> values;
80 };
81
85 struct Content {
87
92 std::string metaData;
93
94 std::vector<Patch> patches;
95 };
96
97 virtual ~PeanoTextPatchFileReader() = default;
98
109 static Header readHeader(const std::string& fileName);
110
118 Content read(const std::string& fileName) const;
119
120 protected:
133 virtual void readValues(
134 std::istream& in,
135 int numberOfValues,
136 std::vector<double>& values
137 ) const;
138
142 virtual Format getFormat() const;
143};
Read a Peano patch file back into memory.
virtual Format getFormat() const
Format this reader supports.
static Header readHeader(const std::string &fileName)
Read only the header of a file.
virtual void readValues(std::istream &in, int numberOfValues, std::vector< double > &values) const
Read the quantities of one patch.
Content read(const std::string &fileName) const
Read the whole file.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
std::string metaData
Content of the meta-data block of the file's header.
Information from the first lines of a file.
std::vector< double > values
All quantities of the patch in the order they are in the file.
std::vector< double > offset
Offset and size of the patch.
int numberOfUnknowns
Number of unknowns per entry, as stored in the file's cell metadata.
int numberOfDoFsPerAxis
Number of entries per axis, as stored in the file's cell metadata.