On Thu, May 7, 2015 at 5:19 AM, Vasileios Vavourakis <[email protected]>
wrote:
> Dear libMesh users.
>
> I was trying to run this very simple test case where a 1D mesh is loaded
> initially, and after inserting a new element in the FE-grid (and probably
> some new nodes) the EquationSystems reinit() routine seems to crash. I
> copy/paste below a test code to demonstrate the case:
>
> //================================================
> int main (int argc, char* argv[]) {
> LibMeshInit init(argc, argv);
>
> Mesh msh(init.comm(), 1);
> EquationSystems es(msh);
>
> es.add_system<System>("a_system");
> es.get_system<System>("a_system").add_variable("a_variable");
>
> GmshIO(msh).read("a_1D_mesh.msh");
> msh.prepare_for_use();
> msh.print_info();
> msh.boundary_info->print_info();
>
> es.init();
> es.print_info();
>
> {
> Elem* e = Elem::build(EDGE2).release();
> e->set_id(msh.max_elem_id());
>
Just guessing, but this might "steal" the ID of the last Elem.
> e->set_node(0) = msh.node_ptr(2);
> e->set_node(1) = msh.node_ptr(8);
> msh.add_elem(e);
>
And this then overwrites the last Elem? Maybe that's what you intended
though. And you are running in debug mode but it didn't trip any asserts
in SerialMesh::add_elem()...
msh.prepare_for_use();
> msh.print_info();
> msh.boundary_info->print_info();
>
> es.reinit();
> es.print_info();
> }
>
> return 0;
> }
> //================================================
>
> the error message I get from valgrind is:
>
> ==8907== Invalid read of size 4
> ==8907== at 0x5AA886: libMesh::DofMap::reinit(libMesh::MeshBase&) (in
> /home/vvavoura/Work/A_TEST/a_test.dbg.exe)
> ==8907== by 0x5B09F0:
> libMesh::DofMap::distribute_dofs(libMesh::MeshBase&) (in
> /home/vvavoura/Work/A_TEST/a_test.dbg.exe)
> ==8907== by 0x4FEEAC: libMesh::EquationSystems::reinit() (in
> /home/vvavoura/Work/A_TEST/a_test.dbg.exe)
> ==8907== by 0x41143E: main (in
> /home/vvavoura/Work/A_TEST/a_test.dbg.exe)
> ==8907== Address 0x4 is not stack'd, malloc'd or (recently) free'd
>
> Cannot figure out what I did wrong :( Also I get the same error if I just
> add a new node in the mesh along with a new 1D element.
> Many thanks in advance.
>
Can you run this through a debugger and get a stack trace too? And please
send me the mesh directly, the mailing list will eat attachments...
--
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