diff --git a/fem/common/discretefunction.cc b/fem/common/discretefunction.cc index 2f5605008e5ed4334301ed3f7224a57c3b5b4c3d..15e372402add1f5e105a79d67ba10cd9d391914a 100644 --- a/fem/common/discretefunction.cc +++ b/fem/common/discretefunction.cc @@ -193,95 +193,6 @@ namespace Dune return *this; } - template<class DiscreteFunctionSpaceType, class DofIteratorImp, - template <class,class> class LocalFunctionIteratorImp, class DiscreteFunctionImp > - inline bool DiscreteFunctionDefault<DiscreteFunctionSpaceType , - DofIteratorImp , LocalFunctionIteratorImp,DiscreteFunctionImp >:: - write(const FileFormatType ftype, const char *filename, int timestep, int - precision ) - { - { - enum { n = DiscreteFunctionSpaceType::DimDomain }; - enum { m = DiscreteFunctionSpaceType::DimRange }; - std::fstream file( filename , std::ios::out ); - StringType d = typeIdentifier<DomainFieldType>(); - StringType r = typeIdentifier<RangeFieldType>(); - - file << "DomainField: " << d << std::endl; - file << "RangeField: " << r << std::endl; - file << "Dim_Domain: " << n << std::endl; - file << "Dim_Range: " << m << std::endl; - file << "Space: " << this->functionSpace_.type() << std::endl; - file << "Format: " << ftype << std::endl; - file << "Precision: " << precision << std::endl; - file << "Polynom_order: " << this->functionSpace_.polynomOrder() << std::endl; - file.close(); - } - - const char * path = 0; - const char * fn = genFilename(path,filename,timestep,precision); - - if(ftype == xdr) - return asImp().write_xdr(fn); - if(ftype == ascii) - return asImp().write_ascii(fn); - if(ftype == pgm) - return asImp().write_pgm(fn); - - return false; - } - - template<class DiscreteFunctionSpaceType, class DofIteratorImp, - template <class,class> class LocalFunctionIteratorImp, class DiscreteFunctionImp > - inline bool DiscreteFunctionDefault<DiscreteFunctionSpaceType , - DofIteratorImp , LocalFunctionIteratorImp,DiscreteFunctionImp >:: - read(const char *filename, int timestep) - { - enum { tn = DiscreteFunctionSpaceType::DimDomain }; - enum { tm = DiscreteFunctionSpaceType::DimRange }; - - int n,m; - std::basic_string <char> r,d; - std::basic_string <char> tr (typeIdentifier<RangeFieldType>()); - std::basic_string <char> td (typeIdentifier<DomainFieldType>()); - - readParameter(filename,"DomainField",d,false); - readParameter(filename,"RangeField",r,false); - readParameter(filename,"Dim_Domain",n,false); - readParameter(filename,"Dim_Range",m,false); - int space; - readParameter(filename,"Space",space,false); - int filetype; - readParameter(filename,"Format",filetype,false); - FileFormatType ftype = static_cast<FileFormatType> (filetype); - int precision; - readParameter(filename,"Precision",precision,false); - - if((d != td) || (r != tr) || (n != tn) || (m != tm) ) - { - std::cerr << d << " | " << td << " DomainField in read!\n"; - std::cerr << r << " | " << tr << " RangeField in read!\n"; - std::cerr << n << " | " << tn << " in read!\n"; - std::cerr << m << " | " << tm << " in read!\n"; - std::cerr << "Can not initialize DiscreteFunction with wrong FunctionSpace! \n"; - abort(); - } - - const char * path = 0; - const char * fn = genFilename(path,filename,timestep,precision); - - if(ftype == xdr) - return asImp().read_xdr(fn); - if(ftype == ascii) - return asImp().read_ascii(fn); - if(ftype == pgm) - return asImp().read_pgm(fn); - - std::cerr << ftype << " FileFormatType not supported at the moment! in file " << __FILE__ << " line " << __LINE__ << "\n"; - abort(); - - return false; - }; } // end namespace Dune diff --git a/fem/common/discretefunction.hh b/fem/common/discretefunction.hh index 47058e700d39b3655c827394f171a0c5b886ebf8..bc23874e848f9e33659acc5c91f00c9ab717e7ab 100644 --- a/fem/common/discretefunction.hh +++ b/fem/common/discretefunction.hh @@ -22,38 +22,6 @@ namespace Dune { @{ */ - typedef std::basic_string <char> StringType; - - /** \brief ??? - * \todo Please doc me! */ - template <typename T> - StringType typeIdentifier () - { - StringType tmp = "unknown"; - return tmp; - }; - - template <> - StringType typeIdentifier<float> () - { - StringType tmp = "float"; - return tmp; - }; - - template <> - StringType typeIdentifier<int> () - { - StringType tmp = "int"; - return tmp; - }; - - template <> - StringType typeIdentifier<double> () - { - StringType tmp = "double"; - return tmp; - }; - //************************************************************************ // @@ -231,14 +199,6 @@ namespace Dune { Vector<RangeFieldType> & add(const Vector<RangeFieldType> &g , RangeFieldType scalar ); - //! write disc func information file and write dofs to file+timestep - //! this method use the write method of the implementation of the - //! discrete function - bool write(const FileFormatType ftype, const char *filename, int timestep, int precision = 6); - - //! same as write only read - bool read(const char *filename, int timestep); - private: // Barton-Nackman trick DiscreteFunctionImp &asImp()