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






------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to