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

Saving in .xdmf with latest FEniCS for parallel running

0 votes

Hello,

Until I was using FEniCS 1.6, I was saving my time dependent solution in xdmf via following command in C++:

File file1("/home/All_Results/Wave/name.xdmf");

Then I switched to FEniCS 2016.1.0 and it gives me an error. I read we need to use XDMFFile so I ran:

XDMFFile file1("/home/All_Results/Wave/name.xdmf");

That doesn't work either. I saw some posts implementing:

XDMFFile file1(mesh.mpi_comm(), "/home/All_Results/Wave/name.xdmf");

But that doesn't work either. What does mesh.mpi_comm() mean? How can I get XDMF to work in C++ with latest FEniCS while running in parallel?

Thank you,

asked Jul 28, 2016 by Chaitanya_Raj_Goyal FEniCS User (4,150 points)

I get the followings errors:

 error: no match for ‘operator<<’ (operand types are ‘dolfin::XDMFFile’ and ‘dolfin::Function’)
     file1 << *u;

error: no match for ‘operator<<’ (operand types are ‘dolfin::XDMFFile’ and ‘dolfin::CellFunction<double>’)
     file2 << eq;

error: ‘class std::shared_ptr<dolfin::UnitSquareMesh>’ has no member named ‘mpi_comm’
   XDMFFile file1(mesh.mpi_comm(), "/home/All_Results/Wave/name.xdmf");

1 Answer

+1 vote
 
Best answer

The information I think is in your error messages:

Error messages 1 & 2: The << operator is not implemented for the XDMFFile, you should try file1.write(*u); and file2.write(eq)

Error message 3: mesh is a shared_ptr so try mesh->mpi_comm()

answered Jul 28, 2016 by nate FEniCS Expert (17,050 points)
selected Jul 29, 2016 by Chaitanya_Raj_Goyal
...