This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Problem with cpp-Expression

+1 vote

Hello,

I'm working with my code and i figured out that it has problem with the c++ expression defined in it.


class Conductivity : public Expression
{
public: // Create expression with 4 components
Conductivity() : Expression(4) {} // Function for evaluating expression on each cell
//void eval(Array& values, const Data& data) const
//void eval(Array& values, const Array& x, const ufc::cell& cell) const
{
const uint D = cell.topological_dimension;
const uint cell_index = cell.entity_indices[D][0];
values[0] = (c00)[cell_index];
values[1] = (
c11)[cell_index];
values[2] = (c22)[cell_index];
values[3] = (
c33)[cell_index];
} // The data stored in mesh functions
boost::shared_ptr<MeshFunction > c00;
boost::shared_ptr<MeshFunction > c11;
boost::shared_ptr<MeshFunction > c22;
boost::shared_ptr<MeshFunction > c33; };
""" c = Expression(cppcode=conductivity_code)

The error I get reads:


    In instant.recompile: The module did not compile with command 'make VERBOSE=1', see '/home/fenics/.instant/error/dolfin_compile_code_12f06d08e034a5c9baf508b1be68a57da59ab1e7/compile.log'
Traceback (most recent call last):
  File "GenerateMatrixMarket.py", line 85, in 
    c = Expression(conductivity_code)
  File "/home/fenics/build/lib/python2.7/site-packages/dolfin/functions/expression.py", line 602, in __new__
    mpi_comm=mpi_comm)
  File "/home/fenics/build/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 217, in compile_expressions
    mpi_comm=mpi_comm)
  File "/home/fenics/build/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 145, in compile_expression_code
    mpi_comm=mpi_comm)
  File "/home/fenics/build/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 64, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/home/fenics/build/lib/python2.7/site-packages/dolfin/compilemodules/compilemodule.py", line 458, in compile_extension_module
    **instant_kwargs)
  File "/home/fenics/build/lib/python2.7/site-packages/instant/build.py", line 563, in build_module
    recompile(modulename, module_path, new_compilation_checksum, build_system)
  File "/home/fenics/build/lib/python2.7/site-packages/instant/build.py", line 165, in recompile
    instant_error(msg % (cmd, compile_log_filename_dest))
  File "/home/fenics/build/lib/python2.7/site-packages/instant/output.py", line 85, in instant_error
    raise RuntimeError(text)
RuntimeError: In instant.recompile: The module did not compile with command 'make VERBOSE=1', see '/home/fenics/.instant/error/dolfin_compile_code_12f06d08e034a5c9baf508b1be68a57da59ab1e7/compile.log'

I've trying to find a solution from other threads but nothing seems to solve my problem.

Thanks in advance for any help.

Cheers

asked May 9, 2016 by Jessica FEniCS Novice (130 points)

Did you look in the file:

/home/fenics/.instant/error/dolfin_compile_code_12f06d08e034a5c9baf508b1be68a57da59ab1e7/compile.log

as suggested by the compiler?

Hi Chris,

Yes, and I think this is where the problem is:


/usr/include/boost/exception/exception.hpp:148:11: note: declaration of ‘class boost::shared_ptr<dolfin::MeshFunction >’
class shared_ptr;
^
CMakeFiles/_dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c.dir/build.make:70: recipe for target 'CMakeFiles/_dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c.dir/dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77cPYTHON_wrap.cxx.o' failed
make[2]: *** [CMakeFiles/_dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c.dir/dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77cPYTHON_wrap.cxx.o] Error 1
make[2]: Leaving directory '/tmp/tmplOmrVY2016-5-9-20-12_instant_3e97b0863b07a98fa5355d368deda17057b014e5/dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/_dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c.dir/all' failed
make[1]: *** [CMakeFiles/_dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c.dir/all] Error 2
make[1]: Leaving directory '/tmp/tmplOmrVY2016-5-9-20-12_instant_3e97b0863b07a98fa5355d368deda17057b014e5/dolfin_compile_code_fd3f26942726c9937bc1631cc272c7555e04d77c'
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

recent versions of dolfin use std::shared_ptr not boost::shared_ptr. Which version are you using?

1.6.0, but this was an old code and that's why is was not working (I had to fix other things as well).

Anyways, all good now, it works!

Many thanks!

...