[MOAB-dev] read polygon mesh from vtk file

Huayi Wei huayiwei1984 at gmail.com
Sun Jun 29 08:12:00 CDT 2014


I try to debug the code and find the problem comes from the line 688 of  
MOAB_DIR/src/io/ReadVtk.cpp.

```
if (first < elem_list.back().front())
```
`elem_list` is a empty vecor, so `elem_list.back().front()` give out a 
segmentation fault. Is it a bug?

Best

Huayi

On 2014年06月29日 12:08, Huayi Wei wrote:
> Hi, Moab Dev,
>
> I have a polygon mesh saved in vtk format, see attachment. I can show 
> it by paraview. But when loading it into moab, I meet `Segmentation 
> fault (core dumped)`
> error. I don't know how to fixed it. Please help me, thanks very much.
>
> Here is the cpp file.
> ```
> #include "moab/Core.hpp"
> #include <iostream>
> #include <assert.h>
>
> using namespace moab;
> using namespace std;
>
> int main(int argc, char ** argv)
> {
>     string file = s"/poly8-10.vtk";
>     Interface * imesh = new Core;
>
>     ErrorCode rval =  imesh->load_mesh(file.c_str());
>     assert(rval == MB_SUCCESS);
>
>     return 0;
> }
> ```
>
> And here is the information of core:
> ```
> Using host libthread_db library 
> "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by `./readpolygon_test'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007f3fee79cd3b in moab::Range::front (this=0xffffffffffffffe0)
>     at ./moab/Range.hpp:824
> 824      { return mHead.mNext->first; }
> (gdb) list
> 819    inline Range::const_iterator 
> Range::const_iterator::start_of_block() const
> 820      { return Range::const_iterator( mNode, mNode->first ); }
> 821
> 822      //! get first entity in range
> 823    inline const EntityHandle& Range::front() const
> 824      { return mHead.mNext->first; }
> 825      //! get last entity in range
> 826    inline const EntityHandle& Range::back() const
> 827      { return mHead.mPrev->second; }
> 828
> ```
>
> Best
>
> Huayi



More information about the moab-dev mailing list