Commit c464bdb9 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed 'using namespace std' from header files in core/

parent 1e9bc62d
Loading
Loading
Loading
Loading
+32 −34
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@

#include "tnlArray.h"

using namespace std;

template< typename Element,
           typename Device,
           typename Index >
@@ -178,8 +176,8 @@ tnlArray< Element, Device, Index >::
setSize( const Index size )
{
   tnlAssert( size >= 0,
              cerr << "You try to set size of tnlArray to negative value."
                   << "New size: " << size << endl );
              std::cerr << "You try to set size of tnlArray to negative value."
                        << "New size: " << size << std::endl );
   if( this->size == size && allocationPointer && ! referenceCounter ) return true;
   this->releaseData();
   tnlArrayOperations< Device >::allocateMemory( this->allocationPointer, size );
@@ -187,8 +185,8 @@ setSize( const Index size )
   this->size = size;
   if( ! this->allocationPointer )
   {
      cerr << "I am not able to allocate new array with size "
           << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << endl;
      std::cerr << "I am not able to allocate new array with size "
                << ( double ) this->size * sizeof( ElementType ) / 1.0e9 << " GB." << std::endl;
      this->size = 0;
      return false;
   }   
@@ -204,8 +202,8 @@ tnlArray< Element, Device, Index >::
setLike( const Array& array )
{
   tnlAssert( array. getSize() >= 0,
              cerr << "You try to set size of tnlArray to negative value."
                   << "Array size: " << array. getSize() << endl );
              std::cerr << "You try to set size of tnlArray to negative value."
                        << "Array size: " << array. getSize() << std::endl );
   return setSize( array.getSize() );
};

@@ -315,7 +313,7 @@ tnlArray< Element, Device, Index >::
setElement( const Index& i, const Element& x )
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for setElement method in tnlArray "
              std::cerr << "Wrong index for setElement method in tnlArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return tnlArrayOperations< Device > :: setMemoryElement( &( this->data[ i ] ), x );
@@ -329,7 +327,7 @@ tnlArray< Element, Device, Index >::
getElement( const Index& i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for getElement method in tnlArray "
              std::cerr << "Wrong index for getElement method in tnlArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return tnlArrayOperations< Device > :: getMemoryElement( & ( this->data[ i ] ) );
@@ -344,7 +342,7 @@ tnlArray< Element, Device, Index >::
operator[] ( const Index& i )
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for operator[] in tnlArray "
              std::cerr << "Wrong index for operator[] in tnlArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return this->data[ i ];
@@ -359,7 +357,7 @@ tnlArray< Element, Device, Index >::
operator[] ( const Index& i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for operator[] in tnlArray "
              std::cerr << "Wrong index for operator[] in tnlArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return this->data[ i ];
@@ -373,8 +371,8 @@ tnlArray< Element, Device, Index >::
operator = ( const tnlArray< Element, Device, Index >& array )
{
   tnlAssert( array. getSize() == this->getSize(),
           cerr << "Source size: " << array. getSize() << endl
                << "Target size: " << this->getSize() << endl );
              std::cerr << "Source size: " << array. getSize() << std::endl
                        << "Target size: " << this->getSize() << std::endl );
   tnlArrayOperations< Device > :: 
   template copyMemory< Element,
                        Element,
@@ -394,8 +392,8 @@ tnlArray< Element, Device, Index >::
operator = ( const Array& array )
{
   tnlAssert( array. getSize() == this->getSize(),
           cerr << "Source size: " << array. getSize() << endl
                << "Target size: " << this->getSize() << endl );
              std::cerr << "Source size: " << array. getSize() << std::endl
                        << "Target size: " << this->getSize() << std::endl );
   tnlArrayOperations< Device,
                       typename Array :: DeviceType > ::
    template copyMemory< Element,
@@ -498,8 +496,8 @@ bool tnlArray< Element, Device, Index > :: save( tnlFile& file ) const
#endif
   if( this->size != 0 && ! tnlArrayIO< Element, Device, Index >::save( file, this->data, this->size ) )
   {
      cerr << "I was not able to save " << this->getType()
           << " with size " << this->getSize() << endl;
      std::cerr << "I was not able to save " << this->getType()
                << " with size " << this->getSize() << std::endl;
      return false;
   }
   return true;
@@ -524,7 +522,7 @@ load( tnlFile& file )
#endif      
   if( _size < 0 )
   {
      cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << endl;
      std::cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << std::endl;
      return false;
   }
   setSize( _size );
@@ -532,8 +530,8 @@ load( tnlFile& file )
   {
      if( ! tnlArrayIO< Element, Device, Index >::load( file, this->data, this->size ) )
      {
         cerr << "I was not able to load " << this->getType()
                    << " with size " << this->getSize() << endl;
         std::cerr << "I was not able to load " << this->getType()
                   << " with size " << this->getSize() << std::endl;
         return false;
      }
   }
@@ -559,7 +557,7 @@ boundLoad( tnlFile& file )
#endif      
   if( _size < 0 )
   {
      cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << endl;
      std::cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << std::endl;
      return false;
   }
   if( this->getSize() != 0 )
@@ -576,8 +574,8 @@ boundLoad( tnlFile& file )
   {
      if( ! tnlArrayIO< Element, Device, Index >::load( file, this->data, this->size ) )
      {
         cerr << "I was not able to load " << this->getType()
                    << " with size " << this->getSize() << endl;
         std::cerr << "I was not able to load " << this->getType()
                   << " with size " << this->getSize() << std::endl;
         return false;
      }
   }
@@ -594,14 +592,14 @@ boundLoad( const tnlString& fileName )
   tnlFile file;
   if( ! file. open( fileName, tnlReadMode ) )
   {
      cerr << "I am not bale to open the file " << fileName << " for reading." << endl;
      std::cerr << "I am not bale to open the file " << fileName << " for reading." << std::endl;
      return false;
   }
   if( ! this->boundLoad( file ) )
      return false;
   if( ! file. close() )
   {
      cerr << "An error occurred when I was closing the file " << fileName << "." << endl;
      std::cerr << "An error occurred when I was closing the file " << fileName << "." << std::endl;
      return false;
   }
   return true;   
+12 −14
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@
#include <core/mfuncs.h>
#include <core/param-types.h>

using namespace std;

template< typename Element,
          typename Device,
          typename Index >
@@ -77,10 +75,10 @@ void tnlConstSharedArray< Element, Device, Index > :: bind( const Element* data,
                                                            const Index size )
{
   tnlAssert( size >= 0,
              cerr << "You try to set size of tnlConstSharedArray to negative value."
                   << "New size: " << size << endl );
              std::cerr << "You try to set size of tnlConstSharedArray to negative value."
                        << "New size: " << size << std::endl );
   tnlAssert( data != 0,
              cerr << "You try to use null pointer to data for tnlConstSharedArray." );
              std::cerr << "You try to use null pointer to data for tnlConstSharedArray." );

   this->size = size;
   this->data = data;
@@ -138,7 +136,7 @@ template< typename Element,
Element tnlConstSharedArray< Element, Device, Index > :: getElement( Index i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for getElement method in tnlConstSharedArray with name "
              std::cerr << "Wrong index for getElement method in tnlConstSharedArray with name "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return tnlArrayOperations< Device >::getMemoryElement( &( this->data[ i ] ) );
@@ -151,7 +149,7 @@ __cuda_callable__
const Element& tnlConstSharedArray< Element, Device, Index > :: operator[] ( Index i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for operator[] in tnlConstSharedArray with name "
              std::cerr << "Wrong index for operator[] in tnlConstSharedArray with name "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   // TODO: add static assert - this does not make sense for tnlCudaDevice
@@ -237,7 +235,7 @@ template< typename Element,
bool tnlConstSharedArray< Element, Device, Index > :: save( tnlFile& file ) const
{
   tnlAssert( this->size != 0,
              cerr << "You try to save empty array." );
              std::cerr << "You try to save empty array." );
   if( ! tnlObject :: save( file ) )
      return false;
#ifdef HAVE_NOT_CXX11
@@ -248,8 +246,8 @@ bool tnlConstSharedArray< Element, Device, Index > :: save( tnlFile& file ) cons
      return false;
   if( ! file. write< Element, Device, Index >( this->data, this->size ) )
   {
      cerr << "I was not able to WRITE tnlConstSharedArray " 
           << " with size " << this->getSize() << endl;
      std::cerr << "I was not able to WRITE tnlConstSharedArray " 
                << " with size " << this->getSize() << std::endl;
      return false;
   }
   return true;
+24 −26
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@
#include <core/mfuncs.h>
#include <core/param-types.h>

using namespace std;

template< typename Element,
          typename Device,
          typename Index >
@@ -108,10 +106,10 @@ void tnlSharedArray< Element, Device, Index > :: bind( Element* data,
                                                       const Index size )
{
   tnlAssert( size >= 0,
              cerr << "You try to set size of tnlSharedArray to negative value."
                   << "New size: " << size << endl );
              std::cerr << "You try to set size of tnlSharedArray to negative value."
                        << "New size: " << size << std::endl );
   tnlAssert( data != 0,
              cerr << "You try to use null pointer to data for tnlSharedArray." );
              std::cerr << "You try to use null pointer to data for tnlSharedArray." );

   this->size = size;
   this->data = data;
@@ -191,7 +189,7 @@ template< typename Element,
void tnlSharedArray< Element, Device, Index > :: setElement( const Index& i, const Element& x )
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for setElement method in tnlSharedArray "
              std::cerr << "Wrong index for setElement method in tnlSharedArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return tnlArrayOperations< Device >::setMemoryElement( & ( this->data[ i ] ), x );
@@ -203,7 +201,7 @@ template< typename Element,
Element tnlSharedArray< Element, Device, Index > :: getElement( const Index& i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for getElement method in tnlSharedArray "
              std::cerr << "Wrong index for getElement method in tnlSharedArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return tnlArrayOperations< Device >::getMemoryElement( &( this->data[ i ] ) );
@@ -216,7 +214,7 @@ __cuda_callable__
Element& tnlSharedArray< Element, Device, Index > :: operator[] ( const Index& i )
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for operator[] in tnlSharedArray "
              std::cerr << "Wrong index for operator[] in tnlSharedArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return this->data[ i ];
@@ -229,7 +227,7 @@ __cuda_callable__
const Element& tnlSharedArray< Element, Device, Index > :: operator[] ( const Index& i ) const
{
   tnlAssert( 0 <= i && i < this->getSize(),
              cerr << "Wrong index for operator[] in tnlSharedArray "
              std::cerr << "Wrong index for operator[] in tnlSharedArray "
                        << " index is " << i
                        << " and array size is " << this->getSize() );
   return this->data[ i ];
@@ -242,8 +240,8 @@ tnlSharedArray< Element, Device, Index >&
    tnlSharedArray< Element, Device, Index > :: operator = ( const tnlSharedArray< Element, Device, Index >& array )
{
   tnlAssert( array. getSize() == this->getSize(),
           cerr << "Source size: " << array. getSize() << endl
                << "Target size: " << this->getSize() << endl );
              std::cerr << "Source size: " << array. getSize() << std::endl
                        << "Target size: " << this->getSize() << std::endl );
   tnlArrayOperations< Device > ::
   template copyMemory< Element,
                        Element,
@@ -261,8 +259,8 @@ template< typename Element,
tnlSharedArray< Element, Device, Index >& tnlSharedArray< Element, Device, Index > :: operator = ( const Array& array )
{
   tnlAssert( array. getSize() == this->getSize(),
           cerr << "Source size: " << array. getSize() << endl
                << "Target size: " << this->getSize() << endl );
              std::cerr << "Source size: " << array. getSize() << std::endl
                        << "Target size: " << this->getSize() << std::endl );
   tnlArrayOperations< typename Array :: DeviceType,
                       Device > ::
    template copyMemory< Element,
@@ -352,7 +350,7 @@ template< typename Element,
bool tnlSharedArray< Element, Device, Index > :: save( tnlFile& file ) const
{
   tnlAssert( this->size != 0,
              cerr << "You try to save empty array." << endl );
              std::cerr << "You try to save empty array." << std::endl );
   if( ! tnlObject :: save( file ) )
      return false;
#ifdef HAVE_NOT_CXX11
@@ -363,7 +361,7 @@ bool tnlSharedArray< Element, Device, Index > :: save( tnlFile& file ) const
      return false;
   if( ! file. write< Element, Device, Index >( this->data, this->size ) )
   {
      cerr << "I was not able to WRITE tnlSharedArray with size " << this->getSize() << endl;
      std::cerr << "I was not able to WRITE tnlSharedArray with size " << this->getSize() << std::endl;
      return false;
   }
   return true;
@@ -394,15 +392,15 @@ bool tnlSharedArray< Element, Device, Index > :: load( tnlFile& file )
#endif
   if( _size != this->size )
   {
      cerr << "Error: The size " << _size << " of the data to be load is different from the " <<
               "allocated array. This is not possible in the shared array." << endl;
      std::cerr << "Error: The size " << _size << " of the data to be load is different from the " <<
                   "allocated array. This is not possible in the shared array." << std::endl;
      return false;
   }
   if( _size )
   {
      if( ! file. read< Element, Device, Index >( this->data, this->size ) )
      {
         cerr << "I was not able to READ tnlSharedArray with size " << this->getSize() << endl;
         std::cerr << "I was not able to READ tnlSharedArray with size " << this->getSize() << std::endl;
         return false;
      }
   }
+1 −3
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@
#include <iostream>
#include <cstdlib>

using namespace std;

#ifdef HAVE_MPI
   #include <mpi.h>
#else
@@ -108,7 +106,7 @@ template< class T > void MPIBcast( T& data,

inline void MPIBcast( tnlString& data, int cout, int root, MPI_Comm comm = MPI_COMM_WORLD )
{
   cerr << "Call method MPIBcast of mString instead of function MPIBcast( mString&, ... ) " << endl;
   std::cerr << "Call method MPIBcast of mString instead of function MPIBcast( mString&, ... ) " << std::endl;
   abort();    
}
#else
+0 −2
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@
#include <core/tnlHost.h>
#include <core/tnlCuda.h>

using namespace std;

enum tnlIOMode { tnlUndefinedMode = 0,
                 tnlReadMode = 1,
                 tnlWriteMode = 2 };
Loading