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

Implementing the mesh initializer.

parent 2ffe494e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ template< class T > class tnlCurve : public tnlObject, public tnlList< tnlCurveE
   //! Erase the curve
   void Erase()
   {
      tnlList< tnlCurveElement< T > > :: EraseAll();
      tnlList< tnlCurveElement< T > >::reset();
   };
   
   //! Method for saving the object to a file as a binary data
+22 −12
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#ifndef mListH
#define mListH

#include <assert.h>
#include <core/tnlAssert.h>
#include <stdlib.h>
#include <iostream>
#include <core/tnlDataElement.h>
@@ -88,7 +88,7 @@ template< class T > class tnlList
   };

   //! Destructor
   ~tnlList() { EraseAll(); };
   ~tnlList() { reset(); };

   //! If the list is empty return 'true'
   bool isEmpty() const { return ! size; };
@@ -99,7 +99,7 @@ template< class T > class tnlList
   //! Indexing operator
   T& operator[] ( int ind )
   {
      assert( ind < size );
      tnlAssert( ind < size, );
      //if( ! size ) return NULL;
      // find fastest way to element with index i
      // we can use iterator as it is set now or
@@ -142,7 +142,7 @@ template< class T > class tnlList
            iterator = iterator -> Next();
            index ++;
         }
         assert( iterator );
         tnlAssert( iterator, );
      }
      return iterator -> Data();
   };
@@ -164,7 +164,7 @@ template< class T > class tnlList
   {
      if( ! first )
      {
         assert( ! last );
         tnlAssert( ! last, );
         first = last = new tnlDataElement< T >( data );
         if( ! first ) return false;
      }
@@ -172,7 +172,7 @@ template< class T > class tnlList
      {
         tnlDataElement< T >* new_element =  new tnlDataElement< T >( data, last, 0 );
         if( ! new_element ) return false;
         assert( last );
         tnlAssert( last, );
         last = last -> Next() = new_element;
      }
      size ++;
@@ -184,7 +184,7 @@ template< class T > class tnlList
   {
      if( ! first )
      {
         assert( ! last );
         tnlAssert( ! last, );
         first = last = new tnlDataElement< T >( data );
         if( ! first ) return false;
      }
@@ -202,7 +202,7 @@ template< class T > class tnlList
   //! Insert new data element at given position
   bool Insert( const T& data, int ind )
   {
      assert( ind <= size || ! size );
      tnlAssert( ind <= size || ! size, );
      if( ind == 0 ) return Prepend( data );
      if( ind == size ) return Append( data );
      operator[]( ind );
@@ -239,6 +239,16 @@ template< class T > class tnlList
      return true;
   };

   template< typename Array >
   void toArray( Array& array )
   {
      tnlAssert( this->getSize() <= array.getSize(),
                 cerr << "this->getSize() = " << this->getSize()
                      << " array.getSize() = " << array.getSize() << endl; );
      for( int i = 0; i < this->getSize(); i++ )
         array[ i ] = ( *this )[ i ];
   }

   //! Erase data element at given position
   void Erase( int ind )
   {
@@ -269,13 +279,13 @@ template< class T > class tnlList
   };

   //! Erase all data elements
   void EraseAll()
   void reset()
   {
      iterator = first;
      tnlDataElement< T >* tmp_it;
      while( iterator )
      {
    	   assert( iterator );
    	   tnlAssert( iterator, );
         tmp_it = iterator;
         iterator = iterator -> Next();
         delete tmp_it;
@@ -356,7 +366,7 @@ template< class T > class tnlList
      }
      return true;
#else
      EraseAll();
      reset();
      int _size;
      file. read( &_size, 1 );
      if( _size < 0 )
@@ -395,7 +405,7 @@ template< class T > class tnlList
      }
      return true;
#else
      EraseAll();
      reset();
      int _size;
      file. read( &_size );
      if( _size < 0 )
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ bool getObjectType( const tnlString& fileName, tnlString& type )
bool parseObjectType( const tnlString& objectType,
                      tnlList< tnlString >& parsedObjectType )
{
   parsedObjectType. EraseAll();
   parsedObjectType.reset();
   int objectTypeLength = objectType. getLength();
   int i = 0;
   /****
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#include <cstring>
#include <string.h>
#include <assert.h>
#include <core/tnlString.h>
#include <debug/tnlDebug.h>
#include <core/tnlAssert.h>
@@ -389,7 +390,7 @@ bool tnlString :: getLine( istream& stream )
int tnlString :: parse( tnlList< tnlString >& list, const char separator ) const
{
   dbgFunctionName( "tnlString", "parse" );
   list. EraseAll();
   list.reset();
   tnlString copy( *this );
   int len = copy. getLength();
   for( int i = 0; i < len; i ++ )
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ bool tnlMatrixReader< Matrix >::readMtxHeader( std::istream& file,
         return false;
      }

      parsedLine. EraseAll();
      parsedLine.reset();
      line. parse( parsedLine );
      if( parsedLine. getSize() != 3 )
      {
Loading