Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add subdomain id from libMesh to the vtk files #179

Merged
merged 1 commit into from

2 participants

@capitalaslash

print out subdomain ids in vtk format.
the patch resembles #145

@jwpeterson
Owner

Seems straightforward enough. Have you tested it?

@capitalaslash

not tested the whole libmesh testsuite, but it is working for me in this project https://github.com/capitalaslash/fsi

@jwpeterson
Owner

I ran the libmesh examples that use VTK, and they seemed to work OK. Thanks for the patch.

@jwpeterson jwpeterson merged commit b0ea174 into from
@capitalaslash

your welcome!
btw, i would be interested in having the possibility to print MONOMIAL CONSTANT variables as cell values instead of interpolating them to point values matching the grid.
to my knowledge, this is not possible whether the io format in libmesh, is it correct?
i can work on a patch for that (at least for VTKIO), would you be interested in including it?

@capitalaslash capitalaslash deleted the branch
@jwpeterson
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2013
  1. @capitalaslash
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/mesh/vtk_io.C
View
6 src/mesh/vtk_io.C
@@ -216,6 +216,10 @@ void VTKIO::cells_to_vtk()
elem_id->SetName("libmesh_elem_id");
elem_id->SetNumberOfComponents(1);
+ vtkSmartPointer<vtkIntArray> subdomain_id = vtkSmartPointer<vtkIntArray>::New();
+ subdomain_id->SetName("subdomain_id");
+ subdomain_id->SetNumberOfComponents(1);
+
MeshBase::const_element_iterator it = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end = mesh.active_local_elements_end();
for (; it != end; ++it, ++active_element_counter)
@@ -268,10 +272,12 @@ void VTKIO::cells_to_vtk()
vtkIdType vtkcellid = cells->InsertNextCell(pts);
types[active_element_counter] = this->get_elem_type(elem->type());
elem_id->InsertTuple1(vtkcellid, elem->id());
+ subdomain_id->InsertTuple1(vtkcellid, elem->subdomain_id());
} // end loop over active elements
_vtk_grid->SetCells(&types[0], cells);
_vtk_grid->GetCellData()->AddArray(elem_id);
+ _vtk_grid->GetCellData()->AddArray(subdomain_id);
}
Something went wrong with that request. Please try again.