Thread Previous • Date Previous • Date Next • Thread Next |
Question #157319 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/157319 Torbjørn Bækø Ness posted a new comment: Hi. I tried following the instructions above to fix a (maybe somewhat) similar problem, but now my code woun't run anymore, due to something that seems totally unrelated. I get the message: Traceback (most recent call last): File "poiLayer.py", line 51, in <module> c.c00 = c00 File "/home/torbjone/.instant/cache/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e.py", line 74, in <lambda> __setattr__ = lambda self, name, value: _swig_setattr(self, Conductivity, name, value) File "/home/torbjone/.instant/cache/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e.py", line 48, in _swig_setattr return _swig_setattr_nondynamic(self,class_type,name,value,0) File "/home/torbjone/.instant/cache/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e/dolfin_compile_code_e7e8fc5d829f08b4d495763a248eab9e.py", line 41, in _swig_setattr_nondynamic if method: return method(self,value) TypeError: in method 'Conductivity_c00_set', argument 2 of type 'dolfin::MeshFunction< double > *' I beleve the relavant part of the code is: # Code for C++ evaluation of conductivity conductivity_code = """ class Conductivity : public Expression { public: // Create expression with 3 components Conductivity() : Expression(3) {} // Function for evaluating expression on each cell //void eval(Array<double>& values, const Data& data) const void eval(Array<double>& values, const Array<double>& 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]; } // The data stored in mesh functions MeshFunction<double>* c00; MeshFunction<double>* c11; MeshFunction<double>* c22; }; """ # Define conductivity expression and matrix c00 = MeshFunction("double", mesh, "c00.xml") c11 = MeshFunction("double", mesh, "c11.xml") c22 = MeshFunction("double", mesh, "c22.xml") c = Expression(cppcode=conductivity_code) c.c00 = c00 c.c11 = c11 c.c22 = c22 C = as_matrix(((c[0], 0, 0), (0, c[1], 0), (0, 0, c[2]))) -- You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN.
Thread Previous • Date Previous • Date Next • Thread Next |