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

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

parent 54bc1ed4
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ class VTKMeshDataReader {
            for (unsigned int j = 0; j < Traits<T>::ttype::template getValue<Index>(data.at(i)).size(); j++){
            for (unsigned int j = 0; j < Traits<T>::ttype::template getValue<Index>(data.at(i)).size(); j++){
                ist >> value[j];
                ist >> value[j];
            }
            }
            DBGVAR(value);
            Traits<T>::ttype::template setValue<Index>(data.at(i), value);
            Traits<T>::ttype::template setValue<Index>(data.at(i), value);
        }
        }


+29 −23
Original line number Original line Diff line number Diff line
@@ -35,20 +35,26 @@ class VTKMeshDataWriter {




        IndexType realIndex = 0;
        IndexType realIndex = 0;
        for (IndexType i = 0; i < writer.getNumberOfCells(); i++) {
        IndexType localIndex = 0;

        for(const std::pair<IndexType, IndexType>& key : writer.backwardCellIndexMapping) {
            auto iterator = writer.backwardCellIndexMapping.find(i);
            while (localIndex < key.first) {
            if (iterator == writer.backwardCellIndexMapping.end()){
                    for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
                    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] << ' ';
                    ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex))[j] << ' ';
                }
                }
                realIndex++;
                realIndex++;
            } else {
                localIndex++;
                realIndex = iterator->second;
            }
            realIndex = key.second;
            localIndex++;
            for (unsigned int j = 0; j < Traits<T>::ttype::template getReference<Index>()->getValue(data.at(0)).size(); j++) {
            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] << ' ';
                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";
        ost << "SCALARS " << Traits<T>::ttype::template getName<Index>() << " double 1\nLOOKUP_TABLE default\n";


        IndexType realIndex = 0;
        IndexType realIndex = 0;
        for (IndexType i = 0; i < writer.getNumberOfCells(); i++) {
        IndexType localIndex = 0;

        for(const std::pair<IndexType, IndexType>& key : writer.backwardCellIndexMapping) {
            auto iterator = writer.backwardCellIndexMapping.find(i);
            while (localIndex < key.first) {
            if (iterator == writer.backwardCellIndexMapping.end()){

                ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
                ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';

                realIndex++;
                realIndex++;
            } else {
                localIndex++;

            }
                realIndex = iterator->second;
            realIndex = key.second;
            localIndex++;
            ost << Traits<T>::ttype::template getValue<Index>(data.at(realIndex)) << ' ';
            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++;
        }
        }
    }
    }