@@ -53,15 +53,10 @@ GetFieldBoundaryAlgo::GetFieldBoundaryAlgo()
5353 addOption (AlgorithmParameterName (" mapping" )," auto" ," auto|node|elem|none" );
5454}
5555
56- struct IndexHash {
57- static const size_t bucket_size = 4 ;
58- static const size_t min_buckets = 8 ;
59-
56+ struct IndexHash
57+ {
6058 size_t operator ()(const index_type &idx) const
6159 { return (static_cast <size_t >(idx)); }
62-
63- bool operator ()(const index_type &i1, const index_type &i2) const
64- { return (i1 < i2); }
6560};
6661
6762bool
@@ -70,7 +65,7 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
7065 ScopedAlgorithmStatusReporter asr (this , " GetFieldBoundary" );
7166
7267 // / Define types we need for mapping
73- typedef boost::unordered_map<index_type,index_type,IndexHash> hash_map_type ;
68+ using hash_map_type = boost::unordered_map<index_type,index_type,IndexHash>;
7469
7570 hash_map_type node_map;
7671 hash_map_type elem_map;
@@ -94,7 +89,7 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
9489 }
9590
9691 // / Figure out which type of field the output is:
97- bool found_method = false ;
92+ auto found_method = false ;
9893 if (fi.is_hex_element ()) { fo.make_quadsurfmesh (); found_method = true ; }
9994 if (fi.is_prism_element ()) { fo.make_quadsurfmesh (); found_method = true ; }
10095 if (fi.is_tet_element ()) { fo.make_trisurfmesh (); found_method = true ; }
@@ -123,13 +118,13 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
123118 }
124119
125120 // / Get the virtual interfaces:
126- VMesh* imesh = input->vmesh ();
127- VMesh* omesh = output->vmesh ();
128- VField* ifield = input->vfield ();
129- VField* ofield = output->vfield ();
130-
131- imesh->synchronize (Mesh::DELEMS_E| Mesh::ELEM_NEIGHBORS_E);
132-
121+ auto imesh = input->vmesh ();
122+ auto omesh = output->vmesh ();
123+ auto ifield = input->vfield ();
124+ auto ofield = output->vfield ();
125+
126+ imesh->synchronize (Mesh::DELEMS_E | Mesh::ELEM_NEIGHBORS_E);
127+
133128 // / These are all virtual iterators, virtual index_types and array_types
134129 VMesh::Elem::iterator be, ee;
135130 VMesh::Elem::index_type nci, ci;
@@ -148,31 +143,31 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
148143 imesh->begin (be);
149144 imesh->end (ee);
150145
151- while (be != ee)
146+ while (be != ee)
152147 {
153148 checkForInterruption ();
154149 ci = *be;
155- imesh->get_delems (delems,ci);
156- for (size_t p =0 ; p < delems.size (); p++)
150+ imesh->get_delems (delems, ci);
151+ for (size_t p = 0 ; p < delems.size (); p++)
157152 {
158- bool includeface = false ;
159-
160- if (!(imesh->get_neighbor (nci,ci,delems[p]))) includeface = true ;
153+ auto includeface = false ;
154+
155+ if (!(imesh->get_neighbor (nci, ci, delems[p]))) includeface = true ;
161156
162157 if (includeface)
163158 {
164- imesh->get_nodes (inodes,delems[p]);
159+ imesh->get_nodes (inodes, delems[p]);
165160 onodes.resize (inodes.size ());
166161
167- for (size_t q= 0 ; q< inodes.size (); q++)
162+ for (size_t q = 0 ; q < inodes.size (); q++)
168163 {
169164 a = inodes[q];
170- hash_map_type::iterator it = node_map.find (a);
165+ auto it = node_map.find (a);
171166 if (it == node_map.end ())
172167 {
173- imesh->get_center (point,a);
168+ imesh->get_center (point, a);
174169 onodes[q] = omesh->add_node (point);
175- node_map[a] = onodes[q];
170+ node_map[a] = onodes[q];
176171 }
177172 else
178173 {
@@ -184,11 +179,11 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
184179 }
185180 ++be;
186181 }
187-
182+
188183 mapping.reset ();
189-
184+
190185 ofield->resize_fdata ();
191-
186+
192187 if (
193188 (
194189 (ifield->basis_order () == 0 )
@@ -308,12 +303,12 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output, MatrixHandle&
308303// / project nodes on.
309304
310305bool
311- GetFieldBoundaryAlgo::run (FieldHandle input, FieldHandle& output)
306+ GetFieldBoundaryAlgo::run (FieldHandle input, FieldHandle& output) const
312307{
313308 ScopedAlgorithmStatusReporter asr (this , " GetFieldBoundary" );
314309
315310 // / Define types we need for mapping
316- typedef boost::unordered_map<index_type,index_type,IndexHash> hash_map_type ;
311+ using hash_map_type = boost::unordered_map<index_type,index_type,IndexHash>;
317312
318313 hash_map_type node_map;
319314 hash_map_type elem_map;
@@ -337,7 +332,7 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output)
337332 }
338333
339334 // / Figure out which type of field the output is:
340- bool found_method = false ;
335+ auto found_method = false ;
341336 if (fi.is_hex_element ()) { fo.make_quadsurfmesh (); found_method = true ; }
342337 if (fi.is_prism_element ()) { fo.make_quadsurfmesh (); found_method = true ; }
343338 if (fi.is_tet_element ()) { fo.make_trisurfmesh (); found_method = true ; }
@@ -366,10 +361,10 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output)
366361 }
367362
368363 // / Get the virtual interfaces:
369- VMesh* imesh = input->vmesh ();
370- VMesh* omesh = output->vmesh ();
371- VField* ifield = input->vfield ();
372- VField* ofield = output->vfield ();
364+ auto imesh = input->vmesh ();
365+ auto omesh = output->vmesh ();
366+ auto ifield = input->vfield ();
367+ auto ofield = output->vfield ();
373368
374369 imesh->synchronize (Mesh::DELEMS_E|Mesh::ELEM_NEIGHBORS_E);
375370
@@ -391,30 +386,30 @@ GetFieldBoundaryAlgo::run(FieldHandle input, FieldHandle& output)
391386 imesh->begin (be);
392387 imesh->end (ee);
393388
394- while (be != ee)
389+ while (be != ee)
395390 {
396391 checkForInterruption ();
397392 ci = *be;
398- imesh->get_delems (delems,ci);
399- for (size_t p =0 ; p < delems.size (); p++)
393+ imesh->get_delems (delems, ci);
394+ for (size_t p = 0 ; p < delems.size (); p++)
400395 {
401- bool includeface = false ;
402-
403- if (!(imesh->get_neighbor (nci,ci,delems[p]))) includeface = true ;
396+ auto includeface = false ;
397+
398+ if (!(imesh->get_neighbor (nci, ci, delems[p]))) includeface = true ;
404399
405400 if (includeface)
406401 {
407- imesh->get_nodes (inodes,delems[p]);
402+ imesh->get_nodes (inodes, delems[p]);
408403 if (onodes.size () == 0 ) onodes.resize (inodes.size ());
409- for (size_t q= 0 ; q< onodes.size (); q++)
404+ for (size_t q = 0 ; q < onodes.size (); q++)
410405 {
411406 a = inodes[q];
412- hash_map_type::iterator it = node_map.find (a);
407+ auto it = node_map.find (a);
413408 if (it == node_map.end ())
414409 {
415- imesh->get_center (point,a);
410+ imesh->get_center (point, a);
416411 onodes[q] = omesh->add_node (point);
417- node_map[a] = onodes[q];
412+ node_map[a] = onodes[q];
418413 }
419414 else
420415 {
0 commit comments