Commit 20b81c7a authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Debugging the mesh I/O.

parent 186f3456
Loading
Loading
Loading
Loading
+250 −747

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ SET( headers tnlGrid.h
             tnlMeshReaderNetgen.h
             tnlMeshWriterNetgen.h
             tnlMeshInitializer.h
             tnlMeshIntegrityChecker.h
             tnlMeshEntityInitializer.h
             tnlMeshSuperentityInitializerLayer.h )

+19 −3
Original line number Diff line number Diff line
@@ -46,6 +46,15 @@ class tnlMeshInitializer

   public:

   tnlMeshInitializer()
   : verbose( false )
   {}

   void setVerbose( bool verbose )
   {
      this->verbose = verbose;
   }

   bool initMesh( MeshType& mesh )
   {
      //cout << "======= Starting mesh initiation ========" << endl;
@@ -53,13 +62,17 @@ class tnlMeshInitializer
      if( ! this->checkCells() )
         return false;
      //cout << "========= Creating entities =============" << endl;
      this->createEntitiesFromCells();
      this->createEntitiesFromCells( this->verbose );
      this->createEntityInitializers();
      //cout << "====== Initiating entities ==============" << endl;
      this->initEntities( *this );
      //cout << "Mesh initiation done..." << endl;
      return true;
   }

   protected:

   bool verbose;
};

template< typename ConfigTag >
@@ -109,7 +122,7 @@ class tnlMeshInitializerLayer< ConfigTag,
      return true;
   }

   void createEntitiesFromCells()
   void createEntitiesFromCells( bool verbose )
   {
      //cout << " Creating entities with " << DimensionsTraits::value << " dimensions..." << endl;
      cellInitializerContainer.setSize( this->getMesh().getNumberOfCells() );
@@ -117,12 +130,15 @@ class tnlMeshInitializerLayer< ConfigTag,
           cell < this->getMesh().getNumberOfCells();
           cell++ )
      {
         //cout << "  Creating the cell number " << cell << endl;
         if( verbose )
            cout << "  Creating the cell number " << cell << "            \r " << flush;
         CellInitializerType& cellInitializer = cellInitializerContainer[ cell ];

         cellInitializer.init( this->getMesh().getCell( cell ), cell );
         BaseType::createEntitiesFromCells( cellInitializer );
      }
      if( verbose )
         cout << endl;

   }

+30 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlMeshIntegrityChecker.h  -  description
                             -------------------
    begin                : Mar 20, 2014
    copyright            : (C) 2014 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLMESHINTEGRITYCHECKER_H_
#define TNLMESHINTEGRITYCHECKER_H_

#include<mesh/tnlMesh.h>

template< typename MeshType >
class tnlMeshIntegrityChecker
{

};


#endif /* TNLMESHINTEGRITYCHECKER_H_ */
+5 −3
Original line number Diff line number Diff line
@@ -135,11 +135,14 @@ class tnlMeshReaderNetgen
       */
       typedef typename MeshType::template EntitiesTraits< dimensions >::GlobalIndexType CellIndexType;
       if( ! inputFile )
       {
          cerr << "I cannot read the mesh cells." << endl;
          return false;
       }
       getline( inputFile, line );
       iss.str( line );
       CellIndexType numberOfCells;
       iss >> numberOfCells;
       CellIndexType numberOfCells=atoi( line.data() );
       //iss >> numberOfCells; // TODO: I do not know why this does not work
       if( ! mesh.template setNumberOfEntities< dimensions >( numberOfCells ) )
       {
          cerr << "I am not able to allocate enough memory for " << numberOfCells << " cells." << endl;
@@ -158,7 +161,6 @@ class tnlMeshReaderNetgen
             iss >> vertexIdx;
             mesh.template getEntity< dimensions >( i ).setVertexIndex( cellVertex, vertexIdx );
          }
          cout << endl;
          if( verbose )
             cout << numberOfCells << " cells expected ... " << i+1 << "/" << numberOfCells << "                 \r" << flush;
       }
Loading