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

Fixing tools.

parent 3fc57315
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ const String& CSR< Real, Device, Index > :: getMatrixClass() const
template< typename Real, typename Device, typename Index >
String CSR< Real, Device, Index > :: getType() const
{
   return String( "CSR< ") +
   return String( "Matrices::CSR< ") +
           String( TNL::getType< Real >() ) +
           String( ", " ) +
           Device :: getDeviceType() +
+0 −6
Original line number Diff line number Diff line
@@ -3,9 +3,6 @@ SET( tnlcurve2gnuplotsources tnlcurve2gnuplot.cpp )
SET( tnlfunctionsbenchmarksources functions-benchmark.cpp
                                  functions-benchmark.h )

SET( tnlmatrixconvertsources tnl-matrix-convert.cpp
                             tnl-matrix-convert.h )

set( tnl_grid_setup_SOURCES tnl-grid-setup.cpp
                            tnl-grid-setup.h )
                            
@@ -58,8 +55,6 @@ IF( BUILD_CUDA )
                         OPTIONS ${CUDA_ADD_EXECUTABLE_OPTIONS} )
    SET_TARGET_PROPERTIES( tnl-cuda-arch${debugExt} PROPERTIES CUDA_COMPILE_FLAGS "${CXX_OPTIMIZE_FLAGS}" )
ENDIF()
#ADD_EXECUTABLE( tnl-matrix-convert${debugExt} ${tnlmatrixconvertsources} )
#target_link_libraries( tnl-matrix-convert${debugExt} tnl${debugExt}-${tnlVersion} )

INSTALL( TARGETS tnl-init${debugExt}
                 tnl-view${debugExt}
@@ -69,7 +64,6 @@ INSTALL( TARGETS tnl-init${debugExt}
                 tnl-dicom-reader${debugExt}
                 tnl-image-converter${debugExt}
                 tnl-curve2gnuplot${debugExt}
#                 tnl-matrix-convert${debugExt}
         RUNTIME DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
         
+4 −3
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ int main( int argc, char* argv[] )
      std::cerr << "Unable to parse the mesh type " << meshType << "." << std::endl;
      return false;
   }
   if( parsedMeshType[ 0 ] == "Grid" )
   if( parsedMeshType[ 0 ] == "Meshes::Grid" ||
       parsedMeshType[ 0 ] == "tnlGrid" )        // TODO: remove deprecated type name
   {
      int dimensions = atoi( parsedMeshType[ 1 ].getString() );
      if( dimensions == 1 )
+20 −12
Original line number Diff line number Diff line
@@ -294,9 +294,11 @@ bool computeDifferenceOfVectors( const MeshPointer& meshPointer, const Config::P
template< typename MeshPointer, typename Element, typename Real, typename Index >
bool computeDifference( const MeshPointer& meshPointer, const String& objectType, const Config::ParameterContainer& parameters )
{
   if( objectType == "MeshFunction" )
   if( objectType == "Functions::MeshFunction" ||
       objectType == "tnlMeshFunction" )  // TODO: remove deprecated type name
      return computeDifferenceOfMeshFunctions< MeshPointer, Element, Real, Index >( meshPointer, parameters );
   if( objectType == "tnlVector" || objectType == "tnlSharedVector" )
   if( objectType == "Containers::Vector" ||
       objectType == "tnlVector" || objectType == "tnlSharedVector" )   // TODO: remove deprecated type name
      return computeDifferenceOfVectors< MeshPointer, Element, Real, Index >( meshPointer, parameters );
}

@@ -308,14 +310,17 @@ bool setIndexType( const MeshPointer& meshPointer,
                   const Config::ParameterContainer& parameters )
{
   String indexType;
   if( parsedObjectType[ 0 ] == "MultiVector" ||
       parsedObjectType[ 0 ] == "tnlSharedMultiVector"   )
   if( parsedObjectType[ 0 ] == "Containers::MultiVector" ||
       parsedObjectType[ 0 ] == "tnlMultiVector" ||                       // TODO: remove deprecated type names
       parsedObjectType[ 0 ] == "tnlSharedMultiVector"   )                //
      indexType = parsedObjectType[ 4 ];
   if( parsedObjectType[ 0 ] == "SharedVector" ||
       parsedObjectType[ 0 ] == "Vector" )
   if( parsedObjectType[ 0 ] == "Containers::Vector" ||
       parsedObjectType[ 0 ] == "tnlSharedVector" ||                     // TODO: remove deprecated type names
       parsedObjectType[ 0 ] == "tnlVector" )                            //
      indexType = parsedObjectType[ 3 ];

   if(parsedObjectType[ 0 ] == "MeshFunction" )
   if( parsedObjectType[ 0 ] == "Functions::MeshFunction" ||
       parsedObjectType[ 0 ] == "tnlMeshFunction" )                      // TODO: remove deprecated type names
      return computeDifference< MeshPointer, Element, Real, typename MeshPointer::ObjectType::IndexType >( meshPointer, parsedObjectType[ 0 ], parameters );
   
   if( indexType == "int" )
@@ -384,13 +389,16 @@ bool setElementType( const MeshPointer& meshPointer,
{
   String elementType;

   if( parsedObjectType[ 0 ] == "MultiVector" ||
       parsedObjectType[ 0 ] == "tnlSharedMultiVector" )
   if( parsedObjectType[ 0 ] == "Containers::MultiVector" ||
       parsedObjectType[ 0 ] == "tnlMultiVector" ||                         // TODO: remove deprecated type names
       parsedObjectType[ 0 ] == "tnlSharedMultiVector" )                    //
      elementType = parsedObjectType[ 2 ];
   if( parsedObjectType[ 0 ] == "MeshFunction" )
   if( parsedObjectType[ 0 ] == "Functions::MeshFunction" ||
       parsedObjectType[ 0 ] == "tnlMeshFunction" )                         // TODO: remove deprecated type names
      elementType = parsedObjectType[ 3 ];
   if( parsedObjectType[ 0 ] == "SharedVector" ||
       parsedObjectType[ 0 ] == "Vector" )
   if( parsedObjectType[ 0 ] == "Containers::Vector" ||
       parsedObjectType[ 0 ] == "tnlSharedVector" ||                        // TODO: remove deprecated type names
       parsedObjectType[ 0 ] == "tnlVector" )                               //
      elementType = parsedObjectType[ 1 ];


tools/src/tnl-matrix-convert.cpp

deleted100644 → 0
+0 −73
Original line number Diff line number Diff line
/***************************************************************************
                          tnl-matrix-convert.cpp  -  description
                             -------------------
    begin                : Jul 23, 2010
    copyright            : (C) 2010 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#include "tnl-matrix-convert.h"
#include <string.h>
#include <TNL/debug/tnlDebug.h>
#include <TNL/Object.h>
#include <TNL/Config/ConfigDescription.h>
#include <TNL/Config/ParameterContainer.h>

#include "tnlConfig.h"
const char configFile[] = TNL_CONFIG_DIRECTORY "tnl-matrix-convert.cfg.desc";

int main( int argc, char* argv[] )
{
   dbgFunctionName( "", "main" );
   dbgInit( "" );

   Config::ParameterContainer parameters;
   Config::ConfigDescription conf_desc;

   if( conf_desc.parseConfigDescription( configFile ) != 0 )
      return 1;
   if( ! parseCommandLine( argc, argv, conf_desc, parameters ) )
   {
      conf_desc.printUsage( argv[ 0 ] );
      return 1;
   }
   String input_file = parameters. getParameter< String >( "input-file" );
   String output_file = parameters. getParameter< String >( "output-file" );
   String output_matrix_format = parameters. getParameter< String >( "output-matrix-format" );
   String precision = parameters. getParameter< String >( "precision" );
   int verbose = parameters. getParameter< int >( "verbose");
   bool verify = parameters. getParameter< bool >( "verify");

   if( verbose )
      std::cout << "Processing file " << input_file << " ... " << std::endl;

   if( precision == "float" )
   {
      if( ! convertMatrix< float >( input_file,
                                    output_file,
                                    output_matrix_format,
                                    verbose,
                                    verify ) )
         return EXIT_FAILURE;
      else
         return EXIT_SUCCESS;
   }

   if( precision == "double" )
   {
      if( ! convertMatrix< double >( input_file,
                                     output_file,
                                     output_matrix_format,
                                     verbose,
                                     verify ) )
         return EXIT_FAILURE;
      else
         return EXIT_SUCCESS;
   }


   std::cerr << "Unknnown precision " << precision << " was given. Can be only float of double." << std::endl;
   return EXIT_FAILURE;
}
Loading