43 const Tag* file_id_tag )
59 file.getline( line, 10000 );
61 while( *liter && isspace( *liter ) )
63 if( *liter !=
'-' )
return MB_FAILURE;
65 if( *liter !=
'1' )
return MB_FAILURE;
67 if( !isspace( *liter ) )
return MB_FAILURE;
72 file.getline( line, 10000 );
73 unsigned int header_id = (
unsigned int)strtol( line, NULL, 10 );
108 int end_of_block = 0;
112 while(
file.getline( line, 10000 ) )
114 il = std::strtol( line, &ctmp, 10 );
118 if( s.empty() ) end_of_block++;
132 char line1[10000], line2[10000];
139 std::streampos top_of_block =
file.tellg();
140 unsigned int num_verts = 0;
145 if( !
file.getline( line1, 10000 ) )
return MB_FAILURE;
146 if( !
file.getline( line2, 10000 ) )
return MB_FAILURE;
149 il1 = std::strtol( line1, &ctmp1, 10 );
150 il2 = std::strtol( line2, &ctmp2, 10 );
151 if( ( il1 == -1 ) && ( il2 == -1 ) )
155 if( ( s1.empty() ) && ( s2.empty() ) )
break;
160 file.seekg( top_of_block );
162 std::vector< double* > arrays;
167 verts.
insert( first_vertex, first_vertex + num_verts - 1 );
169 double* x = arrays[0];
170 double* y = arrays[1];
171 double* z = arrays[2];
175 const int beginning_node_id = 1;
176 int node_id = beginning_node_id;
178 for(
unsigned int i = 0; i < num_verts; i++ )
180 if( !
file.getline( line1, 10000 ) )
return MB_FAILURE;
181 if( !
file.getline( line2, 10000 ) )
return MB_FAILURE;
185 if( node_id != std::strtol( line1, &ctmp1, 10 ) )
186 MB_SET_ERR( MB_FAILURE,
"node_id " << node_id <<
" line2:" << line2 <<
" ctmp1:" << ctmp1 );
191 x[i] = std::strtod( line2, &ctmp2 );
192 y[i] = std::strtod( ctmp2 + 1, &ctmp2 );
193 z[i] = std::strtod( ctmp2 + 1, NULL );
196 if( !
file.getline( line1, 10000 ) )
MB_SET_ERR( MB_FAILURE,
" expect more lines" );
197 if( !
file.getline( line2, 10000 ) )
MB_SET_ERR( MB_FAILURE,
" expect more lines 2" );
211 char line1[10000], line2[10000];
218 Tag mat_tag, phys_tag, id_tag;
227 if( !
file.getline( line1, 10000 ) || !
file.getline( line2, 10000 ) )
return MB_FAILURE;
230 il1 = std::strtol( line1, &ctmp1, 10 );
231 il2 = std::strtol( line2, &ctmp2, 10 );
232 if( ( il1 == -1 ) && ( il2 == -1 ) )
236 if( ( s1.empty() ) && ( s2.empty() ) )
return MB_SUCCESS;
240 const int element_id = strtol( line1 + 1, &ctmp1, 10 );
241 const int ideas_type = strtol( line1 + 11, &ctmp1, 10 );
242 const int phys_table = strtol( line1 + 21, &ctmp1, 10 );
243 const int mat_table = strtol( line1 + 31, &ctmp1, 10 );
247 if(
TRI0 == ideas_type ||
TRI1 == ideas_type )
249 else if(
QUAD0 == ideas_type ||
QUAD1 == ideas_type )
251 else if(
TET == ideas_type )
253 else if(
HEX == ideas_type )
255 else if(
WEDGE == ideas_type )
259 std::cout <<
"IDEAS element type not yet added to MOAB reader." << std::endl;
264 std::stringstream ss( line2 );
268 for(
int i = 0; i < n_conn; ++i )
271 conn[i] = vstart + vert - 1;
281 const void*
const phys_set_id_val[] = { &phys_table };
283 if( phys_sets.
empty() )
288 else if( 1 == phys_sets.
size() )
290 phys_set = phys_sets.
front();
301 const void*
const mat_set_id_val[] = { &mat_table };
304 if( mat_sets.
empty() )
311 else if( 1 == mat_sets.
size() )
313 mat_set = mat_sets.
front();