From 8b3b66bcd8b43cc6dcee32093fee27132518c39a Mon Sep 17 00:00:00 2001
From: Christoph Schwarzmeier <christoph.schwarzmeier@fau.de>
Date: Tue, 3 Mar 2020 09:56:09 +0100
Subject: [PATCH] Change vtk cell connectivity and cell offsets to Int32

---
 src/vtk/VTKOutput.cpp | 32 ++++++++++++++++----------------
 src/vtk/VTKOutput.h   | 24 ++++++++++++------------
 2 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp
index 5f60e2cdf..ec4b31401 100644
--- a/src/vtk/VTKOutput.cpp
+++ b/src/vtk/VTKOutput.cpp
@@ -1,15 +1,15 @@
 //======================================================================================================================
 //
-//  This file is part of waLBerla. waLBerla is free software: you can 
+//  This file is part of waLBerla. waLBerla is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  waLBerla is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  waLBerla is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -366,7 +366,7 @@ void VTKOutput::writeDomainDecompositionPieces( std::ostream& ofs, const Set<SUI
    if( binary_ )
    {
       Base64Writer base64;
-      for( uint32_t i = 0; i != uint32_c( points ); ++i )
+      for( int32_t i = 0; i != int32_c( points ); ++i )
          base64 << i;
       ofs << "     "; base64.toStream( ofs );
    }
@@ -607,7 +607,7 @@ void VTKOutput::writePointData( const std::string& path )
    ofs << "<?xml version=\"1.0\"?>\n"
        << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"" << endianness_ << "\">\n"
        << " <UnstructuredGrid>\n";
-       
+
 
    writePointDataPieceHelper( points, outputPoint, numberOfPoints, ofs );
 
@@ -1072,10 +1072,10 @@ void VTKOutput::writeBlockPieces( std::ostream & oss, const Set<SUID>& requiredS
             writeVTIPiece_sampling( oss, block );
       }
       else // unstructured data -> vtu
-      {  
+      {
          CellVector cells; // cells to be written to file
          computeVTUCells( block, cells );
-         
+
          if( !cells.empty() )
          {
             if( samplingDx_ <= real_c(0) || samplingDy_ <= real_c(0) || samplingDz_ <= real_c(0) )
@@ -1137,7 +1137,7 @@ void VTKOutput::writeVTI_sampling( std::ostream& ofs, const IBlock& block ) cons
 {
    const AABB&  blockBB = block.getAABB();
    const AABB&  domain  = blockStorage_->getDomain();
-   
+
    CellInterval cellBB = getSampledCellInterval( blockBB );
 
    ofs << "<?xml version=\"1.0\"?>\n"
@@ -1644,11 +1644,11 @@ void VTKOutput::writePVD()
 
    std::string file( baseFolder_ + "/" + identifier_ + ".pvd" );
    std::fstream ofs( file.c_str() );
-   
+
    if( !ofs ) // failed because file does not yet exist
    {
       ofs.open( file.c_str(), std::ios::out );
-      
+
       ofs << "<?xml version=\"1.0\"?>\n"
           << "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"" << endianness_ << "\">\n"
           << " <Collection>\n";
@@ -1695,7 +1695,7 @@ void VTKOutput::writePVD()
       ofs << "  <DataSet timestep=\"" << *collector << "\" file=\"" << collection.str() << "\"/>\n";
    }
    allCollectors_.clear();
-   
+
    pvdEnd_ = ofs.tellp();
    WALBERLA_ASSERT_GREATER( pvdEnd_, 0 );
    ofs << " </Collection>\n"
@@ -1831,7 +1831,7 @@ bool VTKOutput::writeCombinedVTI( std::string localPart, const uint_t collector
          << cellBB.yMin() << " " << ( cellBB.yMax() + 1 ) << " "
          << cellBB.zMin() << " " << ( cellBB.zMax() + 1 ) << "\""
          << " Origin=\"" << domain.xMin() << " " << domain.yMin() << " " << domain.zMin() << "\""
-         << " Spacing=\"" << blockStorage_->dx() << " " << blockStorage_->dy() << " " << blockStorage_->dz() 
+         << " Spacing=\"" << blockStorage_->dx() << " " << blockStorage_->dy() << " " << blockStorage_->dz()
          << "\">\n\n";
 
       localPart.insert( 0, header.str() );
diff --git a/src/vtk/VTKOutput.h b/src/vtk/VTKOutput.h
index b563fb284..a9c9ec12d 100644
--- a/src/vtk/VTKOutput.h
+++ b/src/vtk/VTKOutput.h
@@ -1,15 +1,15 @@
 //======================================================================================================================
 //
-//  This file is part of waLBerla. waLBerla is free software: you can 
+//  This file is part of waLBerla. waLBerla is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  waLBerla is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  waLBerla is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -57,7 +57,7 @@ private:
    // types used during vertex-index mapping procedure when writing (P)VTU files
    typedef std::tuple< cell_idx_t, cell_idx_t, cell_idx_t > Vertex;
    typedef std::tuple< real_t,     real_t,     real_t >     VertexCoord;
-   typedef uint32_t Index;
+   typedef int32_t Index;
 
    struct VertexCompare {
       bool operator()( const Vertex& lhs, const Vertex& rhs ) const
@@ -126,7 +126,7 @@ public:
    friend inline shared_ptr<VTKOutput> createVTKOutput_BlockData( const StructuredBlockStorage & sbs, const std::string & identifier,
                                                                   const uint_t writeFrequency, const uint_t ghostLayers, const bool forcePVTU,
                                                                   const std::string & baseFolder, const std::string & executionFolder,
-                                                                  const bool continuousNumbering, const bool binary, const bool littleEndian, 
+                                                                  const bool continuousNumbering, const bool binary, const bool littleEndian,
                                                                   const bool useMPIIO, const uint_t initialExecutionCount );
 
    /// creates a VTKOutput object that is supposed to output arbitrary point data
@@ -140,7 +140,7 @@ public:
    friend inline shared_ptr<VTKOutput> createVTKOutput_PolylineData( const shared_ptr< PolylineDataSource > pds, const std::string & identifier,
                                                                      const uint_t writeFrequency,
                                                                      const std::string & baseFolder, const std::string & executionFolder,
-                                                                     const bool continuousNumbering, const bool binary, const bool littleEndian, 
+                                                                     const bool continuousNumbering, const bool binary, const bool littleEndian,
                                                                      const bool useMPIIO, const uint_t initialExecutionCount );
 
    typedef std::function< void () > BeforeFunction;
@@ -214,7 +214,7 @@ private:
    void writeDomainDecomposition( const std::string& path, const Set<SUID>& requiredStates, const Set<SUID>& incompatibleStates ) const;
    void writeDomainDecompositionPieces( std::ostream& ofs, const Set<SUID>& requiredStates, const Set<SUID>& incompatibleStates ) const;
 
-   void computeOutputPoints( std::vector<Vector3<real_t> > & points, std::vector<bool> & outputPoint, 
+   void computeOutputPoints( std::vector<Vector3<real_t> > & points, std::vector<bool> & outputPoint,
                              uint_t & numberOfPoints ) const;
    void writePointDataPieceHelper( const std::vector<Vector3<real_t> > & points, const std::vector<bool> & outputPoint,
                                    const uint_t numberOfPoints, std::ostream & ofs ) const;
@@ -227,7 +227,7 @@ private:
       uint_t & numberOfPolylines, uint_t & numberOfPolylinePoints ) const;
 
    void writePolylineDataPieceHelper( const std::vector< std::vector< Vector3< real_t > > > & lines,
-      const std::vector< std::vector< bool > > & outputPolylinePoint, const std::vector< size_t > & polylineSize, 
+      const std::vector< std::vector< bool > > & outputPolylinePoint, const std::vector< size_t > & polylineSize,
       const uint_t numberOfPolylines, const uint_t numberOfPolylinePoints, std::ostream & ofs ) const;
 
    void writePolylineData( const std::string& path );
-- 
GitLab