From: Roy S. <roy...@ic...> - 2009-03-05 13:43:20
|
On Thu, 5 Mar 2009, Ping Rong wrote: > i downloaded latest version of libMesh code via svn, and compiled > petsc-3.0.0-p3 by using following configuration > -------------------------------------------------------------- > $./config/configure.py --with-cc=gcc \ > --with-fc=gfortran \ > --with-cxx=g++ \ > --with-mpi-compilers=0 \ > --with-shared=1 \ > --with-debugging=1 \ > --download-mpich=1 \ > --download-f-blas-lapack=1 \ > --with-scalar-type=complex Try it with "--with-clanguage=c++? There's multiple ways that PETSc can support complex number calculations, and I believe libMesh (as well as some C++ compilers) may only be compatible with the C++ standards like "std::complex<double>", not the new C standards like "double complex". Oh, and for future reference, installation/usage problems are more appropriately directed to libmesh-users instead of libmesh-devel. --- Roy |
From: Ping R. <pin...@tu...> - 2009-03-06 13:38:00
|
thanks a lot! I took your advice and compiled PETSc with C++. Then the compilation of libMesh went further. However I encounted another error, ------------------------------------------------------------------------- Compiling C++ (in optimized mode) src/mesh/ensight_io.C... src/mesh/ensight_io.C: In member function ‘void EnsightIO::write_scalar_ascii(const std::string&, const std::string&)’: src/mesh/ensight_io.C:407: error: cannot convert ‘std::complex<double>’ to ‘double’ in assignment src/mesh/ensight_io.C: In member function ‘void EnsightIO::write_vector_ascii(const std::string&, const std::vector<std::basic_string<char,std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&,const std::string&)’: src/mesh/ensight_io.C:503: error: cannot convert ‘std::complex<double>’ to ‘double’ in assignment src/mesh/ensight_io.C:504: error: cannot convert ‘std::complex<double>’ to ‘double’ in assignment src/mesh/ensight_io.C:506: error: cannot convert ‘std::complex<double>’ to ‘double’ in assignment make: *** [src/mesh/ensight_io.i686-pc-linux-gnu.opt.o] Error 1 -------------------------------------------------------------------------- in the file src/mesh/ensight_io.C I found the statements ------------------------------------------------------------------ 379 typedef std::map<int,Real> map_local_soln; 385 std::vector<Number> nodal_soln; 407 local_soln[elem->node(n)] = nodal_soln[n]; ------------------------------------------------------------------ I guess when libMesh is compiled with option --enable-complex, the <Number> type at line 385 implies complex<double>, which does not match the <Real> type at line 379. I am not sure whether this is still an improper compilation or a bug. anyway I substituted "Number" for "Real" at line 379. This works for the convert error at line 407. But since the variable "map_local_soln" is complex now, the statement ------------------------------------------------------------------------- 414 fprintf(fout,"%12.5e\n",(*sol).second); ------------------------------------------------------------------------- where "sol" is an iterator of "map_local_soln", appears to be problematic. I think line 414 attempts to store data in a file, and the file may be used later for other purposes, so I don't know which format will be good for complex number here. The error in line 503, 504 and 506 are basically the same problem. Could the <Real> type be replaced by <Number> type? Or maybe something else is relying on this. Regards Ping On Do, 2009-03-05 at 07:35 -0600, Roy Stogner wrote: > On Thu, 5 Mar 2009, Ping Rong wrote: > > > i downloaded latest version of libMesh code via svn, and compiled > > petsc-3.0.0-p3 by using following configuration > > -------------------------------------------------------------- > > $./config/configure.py --with-cc=gcc \ > > --with-fc=gfortran \ > > --with-cxx=g++ \ > > --with-mpi-compilers=0 \ > > --with-shared=1 \ > > --with-debugging=1 \ > > --download-mpich=1 \ > > --download-f-blas-lapack=1 \ > > --with-scalar-type=complex > > Try it with "--with-clanguage=c++? There's multiple ways that PETSc > can support complex number calculations, and I believe libMesh (as > well as some C++ compilers) may only be compatible with the C++ > standards like "std::complex<double>", not the new C standards like > "double complex". > > Oh, and for future reference, installation/usage problems are more > appropriately directed to libmesh-users instead of libmesh-devel. > --- > Roy -- Mit freundlichen Grüßen M.Sc. Ping Rong Technische Universität Hamburg-Harburg Institut für Modellierung und Berechnung Denickestraße 17 21073 Hamburg DE 17 Raum 3031 Tel.: ++49 - (0)40 - 42878 2749 Fax: ++49 - (0)40 - 42878 43533 |
From: Roy S. <roy...@ic...> - 2009-03-06 14:31:20
|
On Fri, 6 Mar 2009, Ping Rong wrote: > Compiling C++ (in optimized mode) src/mesh/ensight_io.C... > src/mesh/ensight_io.C: In member function ‘void > EnsightIO::write_scalar_ascii(const std::string&, const > std::string&)’: > src/mesh/ensight_io.C:407: error: cannot convert > ‘std::complex<double>’ to ‘double’ in assignment Hmm. It's not too uncommon that some jerk adds code to libMesh SVN without remembering to check compatibility with --enable-complex, but usually I'm the jerk. This one wasn't mine, though, and it's not going to be a trivial fix since fixing it properly requires knowing if and how the ensight file format handles complex numbers. > The error in line 503, 504 and 506 are basically the same problem. Could > the <Real> type be replaced by <Number> type? Or maybe something else is > relying on this. No, this isn't one of our core classes; you're not going to need it unless you explicitly try to read or write a file in that format. In fact, if the file's giving you this much trouble I'd say just comment the whole thing out (along with ensight_io.h, to avoid linker errors) until we get a fix into SVN. Sorry about the trouble. --- Roy |
From: Ping R. <pin...@tu...> - 2009-03-09 16:21:52
|
Hey Roy, thanks again for your time! I commented the file writting part out, and changed <Real> type to <Number>. The compilation was able to get through. Also I collected some other minor errors due to the complex type. I will list them below together with the change i made so that the compiler would stop chattering. ----------------------------------------------------------------------------- file: src/mesh/ensight_io.C error: 407 cannot convert ‘std::complex<double>’ to ‘double’ alteration: 379 typedef std::map<int,Real> map_local_soln; -> typedef std::map<int,Number> map_local_soln; 413, 414 are commented out // since the format to be used for complex number is unclear --------------------------------------------------------------------- error: 503,504 and 506 cannot convert ‘std::complex<double>’ to ‘double’ alteration: 456 typedef std::map<int,std::vector<Real> > map_local_soln; -> typedef std::map<int,std::vector<Number> > map_local_soln; 502 std::vector<Real> vec(3); -> std::vector<Number> vec(3); 515 - 522 are commented out // since the format to be used for complex number is unclear ----------------------------------------------------------------------------- file: src/numerics/numeric_vector.C error: 221 norm += v(*it) * v(*it); //this is not valid for complex alteration: 221 norm += std::norm(v(*it)); ----------------------------------------------------------------------------- file: src/numerics/distributed_vector.C error: 321 this->set(i,fabs(_values[i])); // function 'fabs' is only defined for double, float, and long double alterationn: 321 this->set(i,std::abs(_values[i])); ----------------------------------------------------------------------------- file: src/numerics/laspack_vector.C error: 262 this->set(i,fabs(_values[i])); // function 'fabs' is only defined for double, float, and long double alterationn: 262 this->set(i,std::abs(_values[i])); ----------------------------------------------------------------------------- also it may be worth mentioning, I always get a warning says that ----------------------------------------------------------------------------- /libmesh/include/parallel/parallel.h:82: Warning: inline-Function »Parallel::data_type Parallel::datatype() [with T = std::complex<double>]« is called, but never defined ----------------------------------------------------------------------------- Now compilation is no problem any longer, but linking. I got a load of undefined reference error while building bin/amr. I guess those functions expect a complex type as parameters, and therefore not defined. I tried ./configure --disable-amr, --enable-amr=no and etc. to avoid linking amr, but no luck. Perhaps you can help me out this one, too :) would be really gradful. Best regards Ping On Fr, 2009-03-06 at 08:31 -0600, Roy Stogner wrote: > On Fri, 6 Mar 2009, Ping Rong wrote: > > > Compiling C++ (in optimized mode) src/mesh/ensight_io.C... > > src/mesh/ensight_io.C: In member function ‘void > > EnsightIO::write_scalar_ascii(const std::string&, const > > std::string&)’: > > src/mesh/ensight_io.C:407: error: cannot convert > > ‘std::complex<double>’ to ‘double’ in assignment > > Hmm. It's not too uncommon that some jerk adds code to libMesh SVN > without remembering to check compatibility with --enable-complex, but > usually I'm the jerk. This one wasn't mine, though, and it's not > going to be a trivial fix since fixing it properly requires knowing if > and how the ensight file format handles complex numbers. > > > The error in line 503, 504 and 506 are basically the same problem. Could > > the <Real> type be replaced by <Number> type? Or maybe something else is > > relying on this. > > No, this isn't one of our core classes; you're not going to need it > unless you explicitly try to read or write a file in that format. In > fact, if the file's giving you this much trouble I'd say just comment > the whole thing out (along with ensight_io.h, to avoid linker errors) > until we get a fix into SVN. Sorry about the trouble. > --- > Roy -- Mit freundlichen Grüßen M.Sc. Ping Rong Technische Universität Hamburg-Harburg Institut für Modellierung und Berechnung Denickestraße 17 21073 Hamburg DE 17 Raum 3031 Tel.: ++49 - (0)40 - 42878 2749 Fax: ++49 - (0)40 - 42878 43533 |