Peano 4
Loading...
Searching...
No Matches
ConvertTreeIdIntoDataField.cpp
Go to the documentation of this file.
2
3
6
7
9
10
11#include <map>
12
13
14tarch::logging::Log convert::filter::ConvertTreeIdIntoDataField::_log( "convert::filter::ConvertTreeIdIntoDataField" );
15
16
19
20
21void convert::filter::ConvertTreeIdIntoDataField::apply( convert::data::DataSet& dataSet, convert::data::Variable& inputVariable, std::string targetSelectorName ) {
22 convert::data::Variable targetVariable( targetSelectorName, inputVariable.dofsPerAxis, 1, inputVariable.type, inputVariable.dimensions );
23
24 std::vector<convert::data::PatchData> inputData = dataSet.getData( inputVariable );
25 std::vector<convert::data::PatchData> targetData;
26
27 for (auto& p: inputData) {
29 inputVariable.dimensions,
30 p.offset,
31 p.size,
32 inputVariable.dofsPerAxis,
33 1,
34 p.originTree
35 );
36
37 int points = tarch::la::aPowI(inputVariable.dimensions,inputVariable.dofsPerAxis);
38 for (int i=0; i<points; i++) {
39 newPatch.data[i] = p.originTree;
40 }
41
42 targetData.push_back( newPatch );
43 }
44
45 dataSet.add( targetVariable, targetData );
46
47 logInfo( "apply(...)", "created " << targetData.size() << " data entries" );
48}
#define logInfo(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:411
A dataset is a wrapper around one big map.
Definition DataSet.h:34
std::vector< PatchData > getData(const Variable &selector) const
Definition DataSet.cpp:29
void add(Variable variable, const std::vector< PatchData > &patchData)
If you add a patch, don't free the patch, i.e.
Definition DataSet.cpp:86
A patch is a square or cube in the domain.
Definition PatchData.h:25
double * data
Mapping from variables onto the actual data.
Definition PatchData.h:54
Represents one variable that is subsequently attached to the patches of a file.
Definition Variable.h:18
const PeanoDataType type
Definition Variable.h:32
virtual void apply(convert::data::DataSet &dataSet, convert::data::Variable &inputVariable, std::string targetSelectorName) override
Log Device.
Definition Log.h:516
int aPowI(int i, int a)
Computes the i-th power of a in integer arithmetic.