From: Bartek G. <b.g...@gm...> - 2011-02-03 23:54:36
|
Hello All, I have a Mesh and a corresponding BoundaryMesh and both have associated MeshData objects. Having a given Elem* elem in the Mesh and knowing it's on the boundary, I would like to find the entry in the MeshData associated with the BoundaryMesh that corresponds to a given side of the elem, but I'm struggling. Both MeshData objects (will) contain element-associated data only. The original mesh has tetrahedral elements. Here's the code: Mesh mesh(3); MeshData mesh_data(mesh); mesh_data.activate(); /* get mesh from tetgen */ TetGenIO tetIO(mesh,&mesh_data); tetIO.read("filename"); mesh.partition(1); mesh.find_neighbors(); BoundaryMesh boundary_mesh(3); MeshData boundary_mesh_data(boundary_mesh); boundary_mesh.activate(); mesh.boundary_info->sync(boundary_mesh, &boundary_mesh_data, &mesh_data); /* put dummy data into both MeshData objects */ const Elem* elem = ... // an elem I know to be on the boundary int s = ... // a side that's on the boundary if(elem->neighbor(s)==NULL){ /* Now how do I get the data in boundary_mesh_data associated with the current side?*/ unsigned int id = elem->id(); const Elem* b_elem = boundary_mesh_data.foreign_id_to_elem(id); std::vector<Number> vec = boundary_mesh_data.get_data(b_elem); } But that doesn't seem to work. I get: Have no Elem* associated with the foreign id = 6716 mesh_data.C, line 477 I'm sure I'm missing some step, or perhaps misunderstand what the foreign id is for. Any help will be greatly appreciated! Best wishes, Bartek |