38 void set(
int st,
int idt )
56 const std::vector< std::string >& ,
62 Tag global_id = 0, block_tag = 0, geom_tag = 0, prtn_tag = 0;
78 Tag set_tags[] = { block_tag, geom_tag, prtn_tag };
79 Tag set_ids[] = { block_tag, 0 , prtn_tag };
82 Range elements, nodes;
87 for(
int d = 1; d <= 3; ++d )
92 elements.
merge( tmp_range );
95 for(
int s = 0; s < 3; ++s )
106 for(
int i = 0; i < num_sets; ++i )
109 for(
int d = 1; d < 3; ++d )
111 Range tmp_range, tmp_nodes;
114 elements.
merge( tmp_range );
117 nodes.
merge( tmp_nodes );
120 for(
int s = 0; s < 3; ++s )
127 sets[s].
merge( tmp_range );
136 if( elements.
empty() )
144 std::vector< int > global_id_array( elements.
size() );
145 std::vector< int >::iterator id_iter;
148 id_iter = global_id_array.begin();
156 for( id_iter = global_id_array.begin(); id_iter != global_id_array.end(); ++id_iter )
157 if( *id_iter > max_id ) max_id = *id_iter;
160 std::map< EntityHandle, ElemInfo > elem_sets;
161 std::set< int > elem_global_ids;
162 id_iter = global_id_array.begin();
169 if( !elem_global_ids.insert(
id ).second )
id = ++max_id;
189 elem_global_ids.clear();
190 global_id_array.clear();
194 for(
int s = 0; s < 3; ++s )
196 if( !set_tags[s] )
continue;
215 elem_sets[*j].set( s,
id );
220 std::ofstream out( file_name );
224 out <<
"$MeshFormat" << std::endl;
225 out <<
"2.0 0 " <<
sizeof( double ) << std::endl;
226 out <<
"$EndMeshFormat" << std::endl;
231 const int old_precision = out.precision();
232 out.precision( precision );
235 out <<
"$Nodes" << std::endl;
236 out << nodes.
size() << std::endl;
237 std::vector< double > coords( 3 * nodes.
size() );
240 std::vector< double >::iterator c = coords.begin();
252 out <<
"$EndNodes" << std::endl;
256 out.precision( old_precision );
259 out <<
"$Elements" << std::endl;
260 out << elem_sets.size() << std::endl;
261 for( std::map< EntityHandle, ElemInfo >::iterator i = elem_sets.begin(); i != elem_sets.end(); ++i )
267 out << i->second.id <<
' ' << i->second.type <<
' ' << i->second.count;
268 for(
int j = 0; j < i->second.count; ++j )
269 out <<
' ' << i->second.sets[j];
276 for(
int j = 0; j < num_vtx; ++j )
281 for(
int j = 0; j < num_vtx; ++j )
286 out <<
"$EndElements" << std::endl;