Peano 4
Loading...
Searching...
No Matches
PeanoTextPatchFileWriter_VertexDataWriter.cpp
Go to the documentation of this file.
3
4#include <iomanip>
5
7 const std::string& identifier,
8 int unknownsPerAxis,
9 int numberOfUnknowns, const std::string& description,
10 const std::string& metaData,
11 double* mapping,
13):
14 _writer(writer),
15 _identifier(identifier),
16 _numberOfVerticesPerAxis(unknownsPerAxis),
17 _numberOfUnknowns(numberOfUnknowns),
18 _entryCounter(0) {
19 _writer._snapshotFileOut << "begin vertex-metadata \"" << identifier << "\"" << std::endl
20 << " number-of-unknowns " << _numberOfUnknowns << std::endl
21 << " number-of-dofs-per-axis " << _numberOfVerticesPerAxis << std::endl
22 << " description " << description << std::endl;
23
24 _writer.writeMetaData(metaData);
26
27 _writer._snapshotFileOut << "end vertex-metadata" << std::endl << std::endl;
28
29 _out << std::scientific;
30}
31
33
35 if (precision>0) {
36 _out << std::setprecision(precision);
37 }
38}
39
43
45 for (int i=0; i<_numberOfUnknowns; i++) {
46 if ( std::isnan(value) ) {
47 _out << " nan";
48 }
49 else {
50 if ( std::abs(value) < std::numeric_limits<double>::min() ) value = 0.0;
51 if (tarch::la::equals(value,0.0)) {
52 _out << " 0";
53 }
54 else {
55 _out << " " << value;
56 }
57 }
58 _entryCounter++;
59 }
60 flushIfPatchIsComplete();
61}
62
69 for (int i=0; i<_numberOfUnknowns; i++) {
70 if ( std::isnan(values[i]) ) {
71 _out << " nan";
72 }
73 else {
74 if ( std::abs(values[i]) < std::numeric_limits<float>::min() ){
75 _out << " 0";
76 }
77 else {
78 _out << " " << values[i];
79 }
80 }
81 _entryCounter++;
82 }
83 flushIfPatchIsComplete();
84}
85
87
89/*
90 while (_entryCounter<getVerticesPerPatch()) {
91 _out << std::flush;
92 _writer._snapshotFileOut << " begin vertex-values \"" << _identifier << "\"" << std::endl
93 << " " << _out.rdbuf() << std::endl
94 << " end vertex-values" << std::endl;
95 _out.clear();
96 _entryCounter = 0;
97 }
98*/
99 assertionMsg(false, "not yet implemented" );
100}
101
103 if (_entryCounter>=getVerticesPerPatch()*_numberOfUnknowns) {
104 _out << std::flush;
105 _writer._snapshotFileOut << " begin vertex-values \"" << _identifier << "\"" << std::endl
106 << " " << _out.rdbuf() << std::endl
107 << " end vertex-values" << std::endl;
108 _out.clear();
109 _entryCounter = 0;
110 }
111}
112
#define assertionMsg(expr, message)
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ our matrix elements will nabla phi_i dx f By this will be a sparse as these basis functions are chosen to not overlap with each other almost everywhere In other they have only local support We can read off the right hand side values
tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter & _writer
VertexDataWriter(const std::string &identifier, int unknownsPerAxis, int numberOfUnknowns, const std::string &description, const std::string &metaData, double *mapping, tarch::plotter::griddata::blockstructured::PeanoTextPatchFileWriter &writer)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
int aPowI(int i, int a)
Computes the i-th power of a in integer arithmetic.