[MOAB-dev] iMesh_setAdjTable() causes error in iMesh_load()

Iulian Grindeanu iulian at mcs.anl.gov
Thu Jun 9 14:21:58 CDT 2011


Hi Jed,
I reproduced the error, I didn't install yet your code. 
(I just used imesh load, after setting the table)
/*
 * load_adj.cpp
 *
 *  Created on: Jun 9, 2011
 */

#include "TestRunner.hpp"
#include "iMesh.h"
#include <string.h>
#include <algorithm>

void test_load_adj();

int main( int argc, char* argv[] )
{

  REGISTER_TEST( test_load_adj );

  return RUN_TESTS( argc, argv );
}

void test_load_adj()
{
  int err;
  iMesh_Instance iMeshInst;
  iMesh_newMesh( 0, &iMeshInst, &err, 0 );
  CHECK_EQUAL( iBase_SUCCESS, err );

  iBase_EntitySetHandle root_set1;
  iMesh_getRootSet(iMeshInst, &root_set1, &err);
  CHECK_EQUAL( iBase_SUCCESS, err );

  int  adjtable_arr[16], *table = adjtable_arr;
  int table_a = 16, table_s;

  iMesh_getAdjTable(iMeshInst,&table,&table_a,&table_s,&err);
  CHECK_EQUAL( iBase_SUCCESS, err );

  table[1*4 + 1] = iBase_AVAILABLE; // edge
  table[2*4 + 2] = iBase_AVAILABLE; // face
  iMesh_setAdjTable(iMeshInst,table,table_s,&err);
  CHECK_EQUAL( iBase_SUCCESS, err );

  char filename_mesh1[] = "he6.h5m";
  iMesh_load(iMeshInst, root_set1, filename_mesh1, NULL, &err, strlen(
           filename_mesh1), 0);
  CHECK_EQUAL( iBase_SUCCESS, err );

  iMesh_dtor(iMeshInst, &err);
  CHECK_EQUAL( iBase_SUCCESS, err );
}

It is a logic error in moab, backtrace is

0x002ef52c in moab::Core::get_adjacencies (this=0x80c0ae0, from_entities=..., to_dimension=2, create_if_missing=true, adj_entities=..., operation_type=1) at Core.cpp:1550
(gdb) frame 2
#2  0x00149872 in create_int_ents (mbimesh=0x80e12d8, from_ents=..., in_set=0x0) at iMesh_MOAB.cpp:3016
(gdb) frame 0
#0  get_adjacencies_union<moab::Range::const_iterator> (gMB=0x80c0ae0, begin=..., end=..., to_dimension=2, create_if_missing=true, adj_entities=...) at Core.cpp:1293
(gdb) backtrace
#0  get_adjacencies_union<moab::Range::const_iterator> (gMB=0x80c0ae0, begin=..., end=..., to_dimension=2, create_if_missing=true, adj_entities=...) at Core.cpp:1293
#1  0x002ef52c in moab::Core::get_adjacencies (this=0x80c0ae0, from_entities=..., to_dimension=2, create_if_missing=true, adj_entities=..., operation_type=1) at Core.cpp:1550
#2  0x00149872 in create_int_ents (mbimesh=0x80e12d8, from_ents=..., in_set=0x0) at iMesh_MOAB.cpp:3016
#3  0x0013f87c in imesh_load_ (instance=0x80e12d8, handle=0x0, name=0xbffff204 "he6.h5m", options=0x0, err=0xbffff200, name_len=7, options_len=0) at iMesh_MOAB.cpp:371
#4  0x0804a4f2 in test_load_adj () at load_adj.cpp:66
#5  0x08048e0c in run_test (test=0x804a318 <test_load_adj()>, func_name=0x80bf620 "test_load_adj") at ../../test/TestUtil.hpp:320
#6  0x08049f6d in runner_run_tests (argc=1, argv=0xbffff384) at ../../test/TestRunner.hpp:282
#7  0x0804a187 in main (argc=1, argv=0xbffff384) at load_adj.cpp:20

Basically, it is trying to find adjacent quads for all handles in the database, INCLUDING the set handles
(that is the error it is returning, the set type is out of range for that operation)

I need to talk to Jason/Tim, for the proper fix

Iulian



----- Original Message -----
> Let me know if you need any help setting this up. I'm on google chat.
> 
> 
> It should be pretty easy to install once you have petsc-dev. The
> instructions for petsc-dev are here
> 
> 
> http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html#1_
> 
> 
> On Ubuntu or other recent Linux distro with MPI and ATLAS (for BLAS
> and Lapack) installed, ./configure with no options should just work.
> 
> 
> I think it's worth getting this running because I expect we'll be
> exchanging code somewhat regularly in the coming weeks/months.


More information about the moab-dev mailing list