Commit 9701cb49 authored by Matthieu Constant's avatar Matthieu Constant
Browse files

visu 3d

parent e9b90ced
......@@ -46,6 +46,9 @@ class fluid_problem :
def export(self, output_dir, t, it) :
lib.fluid_problem_export(self._fp, output_dir.encode(), c_double(t), c_int(it))
def export_vtk(self, output_dir, t, it) :
lib.fluid_problem_export_vtk(self._fp, output_dir.encode(), c_double(t), c_int(it))
def compute_node_force(self, dt) :
def np2c(a) :
return c_void_p(a.ctypes.data)
......
......@@ -82,7 +82,6 @@ class ParticleProblem :
def write_vtk(self, odir, i, t) :
lib.particleProblemWriteVtk(self._p, odir.encode(), i)
shutil.move(outputname + "_tmp", outputname)
def add_boundary_disk(self, x0, r, tag) :
lib.particleProblemAddBoundaryDisk.restype = c_size_t
......
......@@ -145,19 +145,27 @@ int fluid_problem_export_vtk(const FluidProblem *problem, const char *output_dir
fprintf(f,"</Points>\n");
fprintf(f,"<Cells>\n");
fprintf(f,"<DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n");
for (int i = 0; i < mesh->n_elements*3; ++i) {
for (int i = 0; i < mesh->n_elements*(DIMENSION+1); ++i) {
fprintf(f,"%i ", mesh->elements[i]);
}
fprintf(f,"\n</DataArray>\n");
fprintf(f,"<DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n");
for(int i = 0; i < mesh->n_elements;++i) {
fprintf(f,"%i ", (i+1)*3);
fprintf(f,"%i ", (i+1)*(DIMENSION+1));
}
#if DIMENSION == 2
fprintf(f,"\n</DataArray>\n");
fprintf(f,"<DataArray type=\"Int32\" Name=\"types\" format=\"ascii\">\n");
for (int i = 0; i < mesh->n_elements; ++i) {
fprintf(f,"%i ", 5); // 10 for 3d
}
#else
fprintf(f,"\n</DataArray>\n");
fprintf(f,"<DataArray type=\"Int32\" Name=\"types\" format=\"ascii\">\n");
for (int i = 0; i < mesh->n_elements; ++i) {
fprintf(f,"%i ", 10); // 10 for 3d
}
#endif
fprintf(f,"\n</DataArray>\n");
fprintf(f,"</Cells>\n");
//fprintf(f,"<PointData Scalars=\"Pressure Porosity\" Vectors=\"Velocity\">\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment