Not sure if this is the best way to send code, but since the mailing list
eats attachments, I'll print the test code here:
#include "libmesh/parallel_mesh.h"
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/node.h"
#include "libmesh/elem.h"
#include "libmesh/multi_predicates.h"
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
LibMeshInit *libmeshhandle = new LibMeshInit(argc, argv, MPI_COMM_WORLD);
Mesh* parent_mesh = new Mesh(libmeshhandle->comm());
Mesh* sub_mesh = new Mesh(libmeshhandle->comm());
double xmin, xmax, ymin, ymax, zmin, zmax;
libMesh::MeshTools::Generation::build_cube( *parent_mesh,
20, 20, 20,
0,20,
0,20,
0,20,
HEX8);
parent_mesh->print_info();
xmin = 5; xmax = 15;
ymin = 5; ymax = 15;
zmin = 5; zmax = 15;
mapvector<Elem*> submesh_elements;
MeshBase::element_iterator it =
parent_mesh->active_local_elements_begin();
const MeshBase::element_iterator it_end =
parent_mesh->active_local_elements_end();
for(;it != it_end; it++)
{
Elem* el = *it;
unsigned int n_nodes = el->n_nodes();
for(unsigned int i=0; i<n_nodes; i++)
{
Node &nd = *(el->get_node(i));
double nd_x = nd(0);
double nd_y = nd(1);
double nd_z = nd(2);
if(nd_x > xmin && nd_x < xmax &&
nd_y > ymin && nd_y < ymax &&
nd_z > zmin && nd_z < zmax)
{
submesh_elements[el->id()] = el;
break;
}
}
}
Predicates::Active<mapvector<Elem*>::const_veclike_iterator > p;
MeshBase::const_element_iterator submesh_begin(submesh_elements.begin(),
submesh_elements.end(), p);
MeshBase::const_element_iterator submesh_end(submesh_elements.end(),
submesh_elements.end(), p);
parent_mesh->create_submesh(*sub_mesh, submesh_begin, submesh_end);
sub_mesh->print_info();
delete sub_mesh;
delete parent_mesh;
delete libmeshhandle;
MPI_Finalize();
}
On Wed, May 13, 2015 at 2:02 PM, John Peterson <[email protected]> wrote:
>
>
> On Wed, May 13, 2015 at 11:13 AM, Bhalla, Amneet Pal Singh <
> [email protected]> wrote:
>
>> I have commented out the line in src/base/libMesh.C which calls
>> MPI_Abort(libMesh::GLOBAL_COMM_WORLD, 1) to get a backtrace…
>>
>
> b MPI_Abort
>
> in the debugger is a good one, too.
>
> --
> John
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users