Commit d44c22a8 authored by Tomáš Jakubec's avatar Tomáš Jakubec
Browse files

Refactor, sppedup the export of the backward mapped cell properties.

parent 54bc1ed4
......@@ -33,6 +33,7 @@ class VTKMeshDataReader {
for (unsigned int j = 0; j < Traits<T>::ttype::template getValue<Index>(data.at(i)).size(); j++){
ist >> value[j];
}
DBGVAR(value);
Traits<T>::ttype::template setValue<Index>(data.at(i), value);
}
......
......@@ -27,29 +27,35 @@ class VTKMeshDataWriter {
{
if (Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size() == MeshDimension)
ost << "VECTORS ";
ost << "VECTORS ";
else if (Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size() == MeshDimension * MeshDimension)
ost << "TENZORS ";
ost << "TENZORS ";
ost << Traits<T>::ttype::template getName<Index>() << " double\n";
IndexType realIndex = 0;
for (IndexType i = 0; i < writer.getNumberOfCells(); i++) {
auto iterator = writer.backwardCellIndexMapping.find(i);
if (iterator == writer.backwardCellIndexMapping.end()){
for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
IndexType localIndex = 0;
for(const std::pair<IndexType, IndexType>& key : writer.backwardCellIndexMapping) {
while (localIndex < key.first) {
for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex))[j] << ' ';
}
realIndex++;
} else {
realIndex = iterator->second;
for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex))[j] << ' ';
}
localIndex++;
}
realIndex = key.second;
localIndex++;
for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex))[j] << ' ';
}
}
while (realIndex < data.size() - 1) {
for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex))[j] << ' ';
}
realIndex++;
}
}
......@@ -64,20 +70,20 @@ class VTKMeshDataWriter {
ost << "SCALARS " << Traits<T>::ttype::template getName<Index>() << " double 1\nLOOKUP_TABLE default\n";
IndexType realIndex = 0;
for (IndexType i = 0; i < writer.getNumberOfCells(); i++) {
auto iterator = writer.backwardCellIndexMapping.find(i);
if (iterator == writer.backwardCellIndexMapping.end()){
IndexType localIndex = 0;
for(const std::pair<IndexType, IndexType>& key : writer.backwardCellIndexMapping) {
while (localIndex < key.first) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
realIndex++;
} else {
realIndex = iterator->second;
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
localIndex++;
}
realIndex = key.second;
localIndex++;
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
}
while (realIndex < data.size() - 1) {
ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
realIndex++;
}
}
......
Supports Markdown
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