Loading src/TNL/Functions/VectorField.h +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <TNL/Config/ParameterContainer.h> #include <TNL/Functions/MeshFunction.h> #include <TNL/Functions/VectorFieldGnuplotWriter.h> #include <TNL/Functions/VectorFieldVTKWriter.h> namespace TNL { namespace Functions { Loading Loading @@ -301,7 +302,7 @@ class VectorField< Size, MeshFunction< Mesh, MeshEntityDimension, Real > > return false; } if( format == "vtk" ) return false; //MeshFunctionVTKWriter< ThisType >::write( *this, file ); return VectorFieldVTKWriter< ThisType >::write( *this, file ); else if( format == "gnuplot" ) return VectorFieldGnuplotWriter< ThisType >::write( *this, file, scale ); else { Loading src/TNL/Functions/VectorFieldVTKWriter.h +37 −1 Original line number Diff line number Diff line Loading @@ -22,9 +22,13 @@ class VectorFieldVTKWriter { public: static bool write( const VectorField& function, static bool write( const VectorField& vectorField, std::ostream& str, const double& scale ); static void writeHeader( const VectorField& vectorField, std::ostream& str ){} }; /*** Loading @@ -45,6 +49,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -65,6 +73,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; Loading @@ -86,6 +98,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -106,6 +122,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -126,6 +146,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; Loading @@ -147,6 +171,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -167,6 +195,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -187,6 +219,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; } // namespace Functions Loading src/TNL/Functions/VectorFieldVTKWriter_impl.h +102 −83 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #pragma once #include <TNL/Functions/VectorFieldVTKWriter.h> #include <TNL/Functions/VectorField.h> namespace TNL { namespace Functions { Loading @@ -18,7 +19,7 @@ namespace Functions { template< typename VectorField > bool VectorFieldVTKWriter< VectorField >:: write( const VectorField& function, write( const VectorField& vectorField, std::ostream& str, const double& scale ) { Loading @@ -33,13 +34,14 @@ write( const VectorField& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -51,16 +53,17 @@ writeHeader( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >:: write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType origin = mesh.getOrigin().x(); const RealType spaceStep = mesh.getSpaceSteps().x(); Loading Loading @@ -90,7 +93,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -103,13 +106,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -118,19 +122,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType origin = mesh.getOrigin().x(); const RealType spaceStep = mesh.getSpaceSteps().x(); Loading Loading @@ -160,7 +165,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -173,13 +178,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -188,19 +194,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -241,7 +248,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -254,13 +261,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -269,21 +277,22 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { typedef typename MeshType::template EntityType< 0 > Vertex; typedef typename MeshType::template EntityType< 1 > Face; writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -331,7 +340,7 @@ write( const VectorFieldType& function, { typename MeshType::Face entity = mesh.template getEntity< typename MeshType::Face >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -344,13 +353,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -359,20 +369,21 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { typedef typename MeshType::template EntityType< 0 > Vertex; writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -411,7 +422,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -424,13 +435,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -439,19 +451,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -508,7 +521,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -521,13 +534,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -536,19 +550,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -628,7 +643,7 @@ write( const VectorFieldType& function, { typename MeshType::Face entity = mesh.template getEntity< typename MeshType::Face >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -641,13 +656,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -656,19 +672,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -742,7 +759,7 @@ write( const VectorFieldType& function, { typename MeshType::Edge entity = mesh.template getEntity< typename MeshType::Edge >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -755,13 +772,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -770,19 +788,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -830,7 +849,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading Loading
src/TNL/Functions/VectorField.h +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <TNL/Config/ParameterContainer.h> #include <TNL/Functions/MeshFunction.h> #include <TNL/Functions/VectorFieldGnuplotWriter.h> #include <TNL/Functions/VectorFieldVTKWriter.h> namespace TNL { namespace Functions { Loading Loading @@ -301,7 +302,7 @@ class VectorField< Size, MeshFunction< Mesh, MeshEntityDimension, Real > > return false; } if( format == "vtk" ) return false; //MeshFunctionVTKWriter< ThisType >::write( *this, file ); return VectorFieldVTKWriter< ThisType >::write( *this, file ); else if( format == "gnuplot" ) return VectorFieldGnuplotWriter< ThisType >::write( *this, file, scale ); else { Loading
src/TNL/Functions/VectorFieldVTKWriter.h +37 −1 Original line number Diff line number Diff line Loading @@ -22,9 +22,13 @@ class VectorFieldVTKWriter { public: static bool write( const VectorField& function, static bool write( const VectorField& vectorField, std::ostream& str, const double& scale ); static void writeHeader( const VectorField& vectorField, std::ostream& str ){} }; /*** Loading @@ -45,6 +49,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -65,6 +73,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; Loading @@ -86,6 +98,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -106,6 +122,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -126,6 +146,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; Loading @@ -147,6 +171,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -167,6 +195,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; /*** Loading @@ -187,6 +219,10 @@ class VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes:: static bool write( const VectorFieldType& function, std::ostream& str, const double& scale ); static void writeHeader( const VectorFieldType& vectorField, std::ostream& str ); }; } // namespace Functions Loading
src/TNL/Functions/VectorFieldVTKWriter_impl.h +102 −83 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #pragma once #include <TNL/Functions/VectorFieldVTKWriter.h> #include <TNL/Functions/VectorField.h> namespace TNL { namespace Functions { Loading @@ -18,7 +19,7 @@ namespace Functions { template< typename VectorField > bool VectorFieldVTKWriter< VectorField >:: write( const VectorField& function, write( const VectorField& vectorField, std::ostream& str, const double& scale ) { Loading @@ -33,13 +34,14 @@ write( const VectorField& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -51,16 +53,17 @@ writeHeader( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >:: write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType origin = mesh.getOrigin().x(); const RealType spaceStep = mesh.getSpaceSteps().x(); Loading Loading @@ -90,7 +93,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -103,13 +106,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -118,19 +122,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType origin = mesh.getOrigin().x(); const RealType spaceStep = mesh.getSpaceSteps().x(); Loading Loading @@ -160,7 +165,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -173,13 +178,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -188,19 +194,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -241,7 +248,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -254,13 +261,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -269,21 +277,22 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { typedef typename MeshType::template EntityType< 0 > Vertex; typedef typename MeshType::template EntityType< 1 > Face; writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -331,7 +340,7 @@ write( const VectorFieldType& function, { typename MeshType::Face entity = mesh.template getEntity< typename MeshType::Face >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -344,13 +353,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -359,20 +369,21 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { typedef typename MeshType::template EntityType< 0 > Vertex; writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -411,7 +422,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -424,13 +435,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -439,19 +451,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -508,7 +521,7 @@ write( const VectorFieldType& function, { typename MeshType::Cell entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -521,13 +534,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -536,19 +550,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -628,7 +643,7 @@ write( const VectorFieldType& function, { typename MeshType::Face entity = mesh.template getEntity< typename MeshType::Face >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -641,13 +656,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -656,19 +672,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -742,7 +759,7 @@ write( const VectorFieldType& function, { typename MeshType::Edge entity = mesh.template getEntity< typename MeshType::Edge >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading @@ -755,13 +772,14 @@ write( const VectorFieldType& function, template< typename MeshReal, typename Device, typename MeshIndex, typename Real > typename Real, int VectorFieldSize > void VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > >:: writeHeader( const VectorFieldType& function, VectorFieldVTKWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >:: writeHeader( const VectorFieldType& vectorField, std::ostream& str ) { const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const typename MeshType::PointType& origin = mesh.getOrigin(); const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; Loading @@ -770,19 +788,20 @@ writeHeader( const VectorFieldType& function, str << "DATASET UNSTRUCTURED_GRID" << std::endl; } template< typename MeshReal, template< int Size, typename MeshReal, typename Device, typename MeshIndex, typename Real > bool VectorFieldVTKWriter< VectorField< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > >:: write( const VectorFieldType& function, write( const VectorFieldType& vectorField, std::ostream& str, const double& scale ) { writeHeader(function, str); writeHeader(vectorField, str); const MeshType& mesh = function.getMesh(); const MeshType& mesh = vectorField.getMesh(); const RealType originX = mesh.getOrigin().x(); const RealType spaceStepX = mesh.getSpaceSteps().x(); const RealType originY = mesh.getOrigin().y(); Loading Loading @@ -830,7 +849,7 @@ write( const VectorFieldType& function, { typename MeshType::Vertex entity = mesh.template getEntity< typename MeshType::Vertex >( i ); entity.refresh(); str << scale * function.getData().getElement( entity.getIndex() ) << std::endl; str << scale * vectorField.getData().getElement( entity.getIndex() ) << std::endl; } return true; Loading