Commit 576521e2 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing writing of mesh functions in tnl-view.

parent bcacf150
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -50,6 +50,14 @@ class tnlMeshFunction :
                       Vector& data,
                       const IndexType& offset = 0 );
      
      static tnlString getType();
      
      tnlString getTypeVirtual() const;
      
      static tnlString getSerializationType();

      virtual tnlString getSerializationTypeVirtual() const;      
      
      static void configSetup( tnlConfigDescription& config,
                               const tnlString& prefix = "" );

+54 −6
Original line number Diff line number Diff line
@@ -55,6 +55,54 @@ tnlMeshFunction( const MeshType& mesh,
   this->bind( mesh, data, offset );   
}

template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
tnlString 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getType()
{
   return tnlString( "tnlMeshFunction< " ) +
                     Mesh::getType() + ", " +
                     tnlString( MeshEntityDimensions ) + ", " +
                     ::getType< Real >() +
                     " >";
};

template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
tnlString 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getTypeVirtual() const
{
   return this->getType();
};

template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
tnlString 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getSerializationType()
{
   return tnlString( "tnlMeshFunction< " ) +
                     Mesh::getSerializationType() + ", " +
                     tnlString( MeshEntityDimensions ) + ", " +
                     ::getType< Real >() +
                     " >";
};

template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
tnlString 
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
getSerializationTypeVirtual() const
{
   return this->getSerializationType();
};

template< typename Mesh,
          int MeshEntityDimensions,
          typename Real >
@@ -275,8 +323,8 @@ bool
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
save( tnlFile& file ) const
{
   //if( ! tnlObject::save( file ) )
   //   return false;
   if( ! tnlObject::save( file ) )
      return false;
   return this->data.save( file );
}

@@ -287,8 +335,8 @@ bool
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
load( tnlFile& file )
{
   //if( ! tnlObject::load( file ) )
   //   return false;
   if( ! tnlObject::load( file ) )
      return false;
   return this->data.load( file );   
}

@@ -299,8 +347,8 @@ bool
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
boundLoad( tnlFile& file )
{
   //if( ! tnlObject::load( file ) )
   //   return false;
   if( ! tnlObject::load( file ) )
      return false;
   return this->data.boundLoad( file );   
}

+16 −13
Original line number Diff line number Diff line
@@ -645,33 +645,36 @@ class tnlNeighbourGridEntityGetter<
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
         /*tnlAssert( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
                    ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ) &&
                    ( ( !! stepZ ) == ( !! entity.getOrientation().z() ) ),
                    cerr << "( stepX, stepY, stepZ ) cannot be perpendicular to entity coordinates: stepX = " << stepX
                         << " stepY = " << stepY << " stepZ = " << stepZ
                         << " entity.getOrientation() = " << entity.getOrientation() );
                         << " entity.getOrientation() = " << entity.getOrientation() );*/
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() < entity.getMesh().getDimensions() + entity.getOrientation(),
              cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                   << " entity.getMesh().getDimensions() + entity.getOrientation() = " << entity.getMesh().getDimensions() + entity.getOrientation()
                   << " EntityDimensions = " << EntityDimensions );
         tnlAssert( entity.getCoordinates() + 
                       CoordinatesType( stepX - ( stepX > 0 ),
                                        stepY - ( stepY > 0 ),
                                        stepZ - ( stepZ > 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                        stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() + 
                       CoordinatesType( stepX - ( stepX > 0 ),
                                        stepY - ( stepY > 0 ),
                                        stepZ - ( stepZ > 0 ) ) < entity.getMesh().getDimensions(),
              cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = "
                   << entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                        stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) < entity.getMesh().getDimensions(),
              cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ), stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) ) = "
                   << entity.getCoordinates()  + CoordinatesType( 
                        stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ),
                        stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ),
                        stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) )
                   << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                   << " EntityDimensions = " << EntityDimensions );
         return NeighbourGridEntityType( entity.getMesh(),
                                         CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ),
                                                          entity.getCoordinates().y() + stepY - ( stepY > 0 ),
                                                          entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) ) );
                                         CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
                                                          entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
                                                          entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
      }
      
      template< int stepX, int stepY, int stepZ >
+4 −4
Original line number Diff line number Diff line
@@ -36,13 +36,13 @@ class tnlPDEOperatorEocTestResult<
{
   public:
      static Real getL1Eoc() { return ( Real ) 0.0; };
      static Real getL1Tolerance() { return ( Real ) 0.05; };
      static Real getL1Tolerance() { return ( Real ) 1.05; };

      static Real getL2Eoc() { return ( Real ) 0.5; };
      static Real getL2Tolerance() { return ( Real ) 0.05; };
      static Real getL2Tolerance() { return ( Real ) 1.05; };

      static Real getMaxEoc() { return ( Real ) 1.0; };
      static Real getMaxTolerance() { return ( Real ) 0.05; };
      static Real getMaxTolerance() { return ( Real ) 1.05; };

};

@@ -109,7 +109,7 @@ bool setGrid()
int main( int argc, char* argv[] )
{
   const int meshSize( 32 );
   const bool writeFunctions( false );
   const bool writeFunctions( true );
   const bool verbose( true );
#ifdef HAVE_CPPUNIT
    return setGrid< tnlHost, meshSize, writeFunctions, verbose >();
+0 −6
Original line number Diff line number Diff line
@@ -24,12 +24,6 @@
#include <mesh/tnlDummyMesh.h>
#include <mesh/tnlGrid.h>

// TODO: Remove
/*#include <mesh/tnlMesh.h>
#include <mesh/tnlMeshWriterNetgen.h>
#include <mesh/config/tnlMeshConfigBase.h>
#include <mesh/topologies/tnlMeshTriangleTopology.h>*/

void setupConfig( tnlConfigDescription& config )
{
   config.addDelimiter                            ( "General settings:" );
Loading