25 #include "libmesh/dof_map.h"
26 #include "libmesh/equation_systems.h"
27 #include "libmesh/nemesis_io_helper.h"
28 #include "libmesh/node.h"
29 #include "libmesh/elem.h"
30 #include "libmesh/boundary_info.h"
31 #include "libmesh/parallel.h"
32 #include "libmesh/mesh_base.h"
33 #include "libmesh/numeric_vector.h"
34 #include "libmesh/int_range.h"
35 #include "libmesh/utility.h"
37 #if defined(LIBMESH_HAVE_NEMESIS_API) && defined(LIBMESH_HAVE_EXODUS_API)
49 bool verbose_in,
bool single_precision) :
54 num_elem_blks_global(0),
55 num_node_sets_global(0),
56 num_side_sets_global(0),
60 num_internal_nodes(0),
62 num_external_nodes(0),
63 num_internal_elems(0),
69 libmesh_experimental();
81 EX_EXCEPTIONLESS_CHECK_ERR(
ex_err,
"Error flushing buffers to file.");
91 Nemesis::ne_get_init_global(
ex_id,
123 Nemesis::ne_get_ss_param_global(
ex_id,
131 libMesh::out <<
"[" << this->
processor_id() <<
"] " <<
"Global Sideset IDs, Side Counts, and DF counts:" << std::endl;
156 Nemesis::ne_get_ns_param_global(
ex_id,
164 libMesh::out <<
"[" << this->
processor_id() <<
"] " <<
"Global Nodeset IDs, Node Counts, and DF counts:" << std::endl;
187 Nemesis::ne_get_eb_info_global(
ex_id,
211 Nemesis::ne_get_init_info(
ex_id,
230 Nemesis::ne_get_loadbal_param(
ex_id,
263 Nemesis::ne_get_elem_map(
ex_id,
295 Nemesis::ne_get_node_map(
ex_id,
333 Nemesis::ne_get_cmap_params(
ex_id,
383 Nemesis::ne_get_node_cmap(
ex_id,
388 EX_CHECK_ERR(
nemesis_err_flag,
"Error reading node cmap node and processor ids!");
425 Nemesis::ne_get_elem_cmap(
ex_id,
431 EX_CHECK_ERR(
nemesis_err_flag,
"Error reading elem cmap elem, side, and processor ids!");
462 unsigned num_proc_in_file_in,
463 const char * ftype_in)
466 Nemesis::ne_put_init_info(
ex_id,
469 const_cast<char *>(ftype_in));
479 unsigned num_elem_blks_global_in,
480 unsigned num_node_sets_global_in,
481 unsigned num_side_sets_global_in)
484 Nemesis::ne_put_init_global(
ex_id,
487 num_elem_blks_global_in,
488 num_node_sets_global_in,
489 num_side_sets_global_in);
497 std::vector<int> & global_elem_blk_cnts_in)
500 Nemesis::ne_put_eb_info_global(
ex_id,
501 global_elem_blk_ids_in.data(),
502 global_elem_blk_cnts_in.data());
504 EX_CHECK_ERR(
nemesis_err_flag,
"Error writing global element block information!");
511 std::vector<int> & num_global_node_counts_in,
512 std::vector<int> & num_global_node_df_counts_in)
518 Nemesis::ne_put_ns_param_global(
ex_id,
519 global_nodeset_ids_in.data(),
520 num_global_node_counts_in.data(),
521 num_global_node_df_counts_in.data());
531 std::vector<int> & num_global_side_counts_in,
532 std::vector<int> & num_global_side_df_counts_in)
538 Nemesis::ne_put_ss_param_global(
ex_id,
539 global_sideset_ids_in.data(),
540 num_global_side_counts_in.data(),
541 num_global_side_df_counts_in.data());
551 unsigned num_border_nodes_in,
552 unsigned num_external_nodes_in,
553 unsigned num_internal_elems_in,
554 unsigned num_border_elems_in,
555 unsigned num_node_cmaps_in,
556 unsigned num_elem_cmaps_in)
559 Nemesis::ne_put_loadbal_param(
ex_id,
560 num_internal_nodes_in,
562 num_external_nodes_in,
563 num_internal_elems_in,
577 std::vector<int> & node_cmap_node_cnts_in,
578 std::vector<int> & elem_cmap_ids_in,
579 std::vector<int> & elem_cmap_elem_cnts_in)
587 Nemesis::ne_put_cmap_params(
ex_id,
588 node_cmap_ids_in.data(),
589 node_cmap_node_cnts_in.data(),
590 elem_cmap_ids_in.data(),
591 elem_cmap_elem_cnts_in.data(),
601 std::vector<std::vector<int>> & node_cmap_proc_ids_in)
612 for (
const auto & node_id : node_cmap_node_ids_in[i])
620 for (
const auto & proc_id : node_cmap_proc_ids_in[i])
628 int * node_ids_ptr = node_cmap_node_ids_in[i].empty() ?
629 nullptr : node_cmap_node_ids_in[i].data();
630 int * proc_ids_ptr = node_cmap_proc_ids_in[i].empty() ?
631 nullptr : node_cmap_proc_ids_in[i].data();
635 node_ids_ptr, proc_ids_ptr,
638 EX_CHECK_ERR(
nemesis_err_flag,
"Error writing node communication map to file!");
646 std::vector<int> & node_mapb_in,
647 std::vector<int> & node_mape_in)
650 Nemesis::ne_put_node_map(
ex_id,
651 node_mapi_in.empty() ? nullptr : node_mapi_in.data(),
652 node_mapb_in.empty() ? nullptr : node_mapb_in.data(),
653 node_mape_in.empty() ? nullptr : node_mape_in.data(),
656 EX_CHECK_ERR(
nemesis_err_flag,
"Error writing Nemesis internal and border node maps to file!");
663 std::vector<std::vector<int>> & elem_cmap_side_ids_in,
664 std::vector<std::vector<int>> & elem_cmap_proc_ids_in)
669 Nemesis::ne_put_elem_cmap(
ex_id,
671 elem_cmap_elem_ids_in[i].
data(),
672 elem_cmap_side_ids_in[i].
data(),
673 elem_cmap_proc_ids_in[i].
data(),
676 EX_CHECK_ERR(
nemesis_err_flag,
"Error writing elem communication map to file!");
684 std::vector<int> & elem_mapb_in)
687 Nemesis::ne_put_elem_map(
ex_id,
688 elem_mapi_in.empty() ? nullptr : elem_mapi_in.data(),
689 elem_mapb_in.empty() ? nullptr : elem_mapb_in.data(),
692 EX_CHECK_ERR(
nemesis_err_flag,
"Error writing Nemesis internal and border element maps to file!");
701 unsigned num_nodes_in,
702 std::vector<Real> & x_coor,
703 std::vector<Real> & y_coor,
704 std::vector<Real> & z_coor)
709 Nemesis::ne_put_n_coord(
ex_id,
712 x_coor.empty() ? nullptr : x_coor.data(),
713 y_coor.empty() ? nullptr : y_coor.data(),
714 z_coor.empty() ? nullptr : z_coor.data());
740 comp_ws =
sizeof(float);
741 io_ws =
sizeof(float);
745 comp_ws = cast_int<int>(std::min(
sizeof(
Real),
sizeof(
double)));
746 io_ws = cast_int<int>(std::min(
sizeof(
Real),
sizeof(
double)));
749 this->
ex_id = exII::ex_create(filename.c_str(), EX_CLOBBER, &comp_ws, &io_ws);
751 EX_CHECK_ERR(
ex_id,
"Error creating Nemesis mesh file.");
754 libMesh::out <<
"File created successfully." << std::endl;
934 const std::string & title_in)
963 EX_CHECK_ERR(
ex_err,
"Error initializing new Nemesis file.");
1012 for (; it !=
end; ++it)
1015 libmesh_assert_equal_to (static_cast<unsigned>(this->
elem_cmap_ids[cnt]), it->first);
1018 std::set<std::pair<unsigned,unsigned>> & elem_set = it->second;
1025 std::set<std::pair<unsigned,unsigned>>::iterator elem_set_iter = elem_set.begin();
1028 for (std::size_t j=0, eceis=this->
elem_cmap_elem_ids[cnt].size(); j<eceis; ++j, ++elem_set_iter)
1081 libmesh_assert_less_equal
1094 for (; it !=
end; ++it)
1097 libmesh_assert_equal_to (static_cast<unsigned>(this->
node_cmap_ids[cnt]), it->first);
1100 std::set<unsigned> &
node_set = it->second;
1106 std::set<unsigned>::iterator node_set_iter =
node_set.begin();
1109 for (std::size_t j=0, nceis=this->
node_cmap_node_ids[cnt].size(); j<nceis; ++j, ++node_set_iter)
1137 for (
const auto & proc_id : id_vec)
1163 for (; it !=
end; ++it)
1198 for (; it !=
end; ++it)
1230 std::set<unsigned> all_elem_ids;
1235 std::set<unsigned> neighboring_processor_ids;
1242 all_elem_ids.insert(elem->id());
1245 bool is_border_elem =
false;
1261 for (
auto node : elem->node_index_range())
1265 for (
auto n : elem->side_index_range())
1267 if (elem->neighbor_ptr(n) !=
nullptr)
1269 unsigned neighbor_proc_id = elem->neighbor_ptr(n)->processor_id();
1275 is_border_elem =
true;
1276 neighboring_processor_ids.insert(neighbor_proc_id);
1279 unsigned nemesis_side_id = conv.get_inverse_side_map(n);
1284 <<
" mapped to (1-based) Exodus side "
1291 this->
proc_border_elem_sets[ neighbor_proc_id ].insert( std::make_pair(elem->id(), nemesis_side_id) );
1304 std::set_difference(all_elem_ids.begin(), all_elem_ids.end(),
1316 for (
const auto &
id : neighboring_processor_ids)
1323 cast_int<int>(neighboring_processor_ids.size());
1327 <<
"Number of neighboring processor IDs="
1338 << pr.first <<
" communicates "
1339 << pr.second.size() <<
" elements." << std::endl;
1366 std::set<boundary_id_type> global_side_boundary_ids
1371 this->
comm().set_union(global_side_boundary_ids);
1375 cast_int<int>(global_side_boundary_ids.size());
1380 global_side_boundary_ids.begin(),
1381 global_side_boundary_ids.end());
1393 typedef std::tuple<dof_id_type, unsigned short int, boundary_id_type> Tuple;
1397 std::vector<Tuple>::iterator
1398 it = bc_triples.begin(),
1399 new_end = bc_triples.end();
1401 while (it != new_end)
1416 bc_triples.erase(new_end, bc_triples.end());
1426 cast_int<int>(std::count_if(bc_triples.begin(),
1428 [id](
const Tuple & t)->
bool {
return std::get<2>(t) == id; }));
1458 std::set<boundary_id_type> local_node_boundary_ids;
1461 std::set<boundary_id_type> global_node_boundary_ids
1466 local_node_boundary_ids = global_node_boundary_ids;
1469 this->
comm().set_union(global_node_boundary_ids);
1473 cast_int<int>(global_node_boundary_ids.size());
1478 global_node_boundary_ids.begin(),
1479 global_node_boundary_ids.end());
1489 for (
const auto &
id : local_node_boundary_ids)
1497 typedef std::tuple<dof_id_type, boundary_id_type> Tuple;
1503 << bc_tuples.size() << std::endl;
1505 for (
const auto & t : bc_tuples)
1506 libMesh::out <<
"(" << std::get<0>(t) <<
", " << std::get<1>(t) <<
") ";
1521 std::vector<Tuple>::iterator
1522 it = bc_tuples.begin(),
1523 new_end = bc_tuples.end();
1525 while (it != new_end)
1540 bc_tuples.erase(new_end, bc_tuples.end());
1547 cast_int<int>(std::count_if(bc_tuples.begin(),
1549 [id](
const Tuple & t)->
bool {
return std::get<1>(t) == id; }));
1570 std::set<subdomain_id_type> global_subdomain_ids;
1573 std::map<subdomain_id_type, unsigned> global_subdomain_counts;
1586 global_subdomain_ids.insert(cur_subdomain);
1589 global_subdomain_counts[cur_subdomain]++;
1597 std::vector<subdomain_id_type> global_subdomain_ids_vector(global_subdomain_ids.begin(),
1598 global_subdomain_ids.end());
1601 this->
comm().allgather(global_subdomain_ids_vector);
1604 global_subdomain_ids.insert(global_subdomain_ids_vector.begin(),
1605 global_subdomain_ids_vector.end());
1610 cast_int<int>(global_subdomain_ids.size());
1616 for (
const auto & pr : global_subdomain_counts)
1619 << static_cast<unsigned>(pr.first)
1620 <<
", Count: " << pr.second <<
", ";
1632 for (
const auto &
id : global_subdomain_ids)
1649 global_subdomain_ids.begin(),
1650 global_subdomain_ids.end());
1693 <<
"local_subdomain_counts [" << static_cast<unsigned>(pr.first) <<
"]= "
1707 for (
auto n : elem->node_index_range())
1757 std::vector<dof_id_type> & elem_ids_this_subdomain = pr.second;
1760 if (elem_ids_this_subdomain.size() == 0)
1761 libmesh_error_msg(
"Error, no element IDs found in subdomain " << pr.first);
1776 current_block_connectivity.clear();
1777 current_block_connectivity.resize(elem_ids_this_subdomain.size() * this->
num_nodes_per_elem);
1779 for (
auto i :
index_range(elem_ids_this_subdomain))
1781 auto elem_id = elem_ids_this_subdomain[i];
1795 libmesh_assert_equal_to (elem.n_nodes(),
Elem::build(conv.libmesh_elem_type(),
nullptr)->
n_nodes());
1800 const unsigned int elem_node_index = conv.get_node_map(j);
1802 current_block_connectivity[connect_index] =
1804 elem.node_id(elem_node_index));
1823 std::map<unsigned, std::set<unsigned>> proc_nodes_touched;
1835 std::set<unsigned> & set_p = proc_nodes_touched[ elem->processor_id() ];
1838 for (
auto node : elem->node_index_range())
1839 set_p.insert(elem->node_id(node));
1846 cast_int<int>(proc_nodes_touched.size() -
1856 <<
"] proc_nodes_touched contains "
1857 << proc_nodes_touched.size()
1858 <<
" sets of nodes."
1861 for (
const auto & pr : proc_nodes_touched)
1863 <<
"] proc_nodes_touched[" << pr.first <<
"] has "
1872 for (
auto & pr : proc_nodes_touched)
1875 if (pr.first == this->processor_id())
1879 std::set<unsigned> & my_set = proc_nodes_touched[this->
processor_id()];
1880 std::set<unsigned> & other_set = pr.second;
1883 std::set_intersection(my_set.begin(), my_set.end(),
1884 other_set.begin(), other_set.end(),
1885 std::inserter(result_set, result_set.end()));
1892 <<
"] this->proc_nodes_touched_intersections[" << pr.first <<
"] has "
1902 std::set<unsigned> & other_set = pr.second;
1903 std::set<unsigned> intermediate_result;
1906 other_set.begin(), other_set.end(),
1907 std::inserter(intermediate_result, intermediate_result.end()));
1913 libmesh_assert_less_equal
1914 (this->proc_nodes_touched_intersections.size(),
1941 std::map<boundary_id_type, std::vector<int>> local_node_boundary_id_lists;
1948 typedef std::tuple<dof_id_type, boundary_id_type> Tuple;
1949 std::vector<Tuple> bc_tuples =
mesh.get_boundary_info().build_node_list();
1954 << bc_tuples.size() << std::endl;
1956 for (
const auto & t : bc_tuples)
1957 libMesh::out <<
"(" << std::get<0>(t) <<
", " << std::get<1>(t) <<
") ";
1964 for (
const auto & t : bc_tuples)
1974 std::vector<int> & current_id_set = local_node_boundary_id_lists[std::get<1>(t)];
1978 current_id_set.push_back( it->second );
1985 for (
const auto & pr : local_node_boundary_id_lists)
1990 for (
const auto &
id : pr.second)
2004 const std::string & current_ns_name =
2005 mesh.get_boundary_info().get_nodeset_name
2006 (cast_int<boundary_id_type>(nodeset_id));
2010 names_table.push_back_entry(current_ns_name);
2015 <<
"] Writing out Exodus nodeset info for ID: " << nodeset_id
2016 <<
", Name: " << current_ns_name
2021 int exodus_id = nodeset_id;
2032 local_node_boundary_id_lists.find (cast_int<boundary_id_type>(nodeset_id));
2035 if (it == local_node_boundary_id_lists.end())
2039 <<
"] No nodeset data for ID: " << nodeset_id
2040 <<
" on this processor." << std::endl;
2043 this->
ex_err = exII::ex_put_node_set_param(this->
ex_id,
2047 EX_CHECK_ERR(this->
ex_err,
"Error writing nodeset parameters in Nemesis");
2053 std::vector<int> & current_nodeset_ids = it->second;
2056 this->
ex_err = exII::ex_put_node_set_param(this->
ex_id,
2058 current_nodeset_ids.size(),
2061 EX_CHECK_ERR(this->
ex_err,
"Error writing nodeset parameters in Nemesis");
2066 current_nodeset_ids.data());
2068 EX_CHECK_ERR(this->
ex_err,
"Error writing nodesets in Nemesis");
2076 names_table.get_char_star_star());
2077 EX_CHECK_ERR(
ex_err,
"Error writing nodeset names");
2094 std::map<boundary_id_type, std::vector<int>> local_elem_boundary_id_lists;
2095 std::map<boundary_id_type, std::vector<int>> local_elem_boundary_id_side_lists;
2098 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bndry_elem_side_id_list =
2099 mesh.get_boundary_info().build_side_list();
2102 for (
const auto & t : bndry_elem_side_id_list)
2105 const Elem * elem =
mesh.elem_ptr(std::get<0>(t));
2107 std::vector<const Elem *> family;
2108 #ifdef LIBMESH_ENABLE_AMR
2115 family.push_back( elem );
2121 for (
const auto & tree_elem : family)
2124 const Elem & f =
mesh.elem_ref(f_id);
2137 local_elem_boundary_id_side_lists[ std::get<2>(t) ].push_back(conv.get_inverse_side_map( std::get<1>(t) ));
2151 const std::string & current_ss_name =
2152 mesh.get_boundary_info().get_sideset_name
2153 (cast_int<boundary_id_type>(exodus_id));
2157 names_table.push_back_entry(current_ss_name);
2162 <<
"] Writing out Exodus sideset info for ID: " << exodus_id
2163 <<
", Name: " << current_ss_name
2169 local_elem_boundary_id_lists.find (cast_int<boundary_id_type>(exodus_id));
2172 if (it == local_elem_boundary_id_lists.end())
2176 <<
"] No sideset data for ID: " << exodus_id
2177 <<
" on this processor." << std::endl;
2180 this->
ex_err = exII::ex_put_side_set_param(this->
ex_id,
2184 EX_CHECK_ERR(this->
ex_err,
"Error writing sideset parameters in Nemesis");
2190 std::vector<int> & current_sideset_elem_ids = it->second;
2193 std::vector<int> & current_sideset_side_ids =
2194 libmesh_map_find(local_elem_boundary_id_side_lists,
2195 cast_int<boundary_id_type>(exodus_id));
2198 this->
ex_err = exII::ex_put_side_set_param(this->
ex_id,
2200 current_sideset_elem_ids.size(),
2203 EX_CHECK_ERR(this->
ex_err,
"Error writing sideset parameters in Nemesis");
2208 current_sideset_elem_ids.data(),
2209 current_sideset_side_ids.data());
2211 EX_CHECK_ERR(this->
ex_err,
"Error writing sidesets in Nemesis");
2220 names_table.get_char_star_star());
2221 EX_CHECK_ERR(
ex_err,
"Error writing sideset names");
2232 x.resize(local_num_nodes);
2233 y.resize(local_num_nodes);
2234 z.resize(local_num_nodes);
2245 if (local_num_nodes)
2250 x_single(
x.begin(),
x.end()),
2251 y_single(
y.begin(),
y.end()),
2252 z_single(
z.begin(),
z.end());
2267 EX_CHECK_ERR(
ex_err,
"Error writing node coordinates");
2271 EX_CHECK_ERR(
ex_err,
"Error writing node num map");
2275 ex_err = exII::ex_put_coord(
ex_id,
nullptr,
nullptr,
nullptr);
2276 EX_CHECK_ERR(
ex_err,
"Error writing empty node coordinates");
2278 ex_err = exII::ex_put_node_num_map(
ex_id,
nullptr);
2279 EX_CHECK_ERR(
ex_err,
"Error writing empty node num map");
2306 (
mesh.subdomain_name(cast_int<subdomain_id_type>(this->global_elem_blk_ids[i])));
2309 std::map<int, std::vector<int>>::iterator it =
2315 this->
ex_err = exII::ex_put_elem_block(this->
ex_id,
2322 EX_CHECK_ERR(this->
ex_err,
"Error writing element block from Nemesis.");
2329 cast_int<subdomain_id_type>(it->first);
2330 std::vector<int> & this_block_connectivity = it->second;
2331 std::vector<dof_id_type> & elements_in_this_block =
subdomain_map[block];
2344 conv.exodus_elem_type().c_str(),
2345 elements_in_this_block.size(),
2348 EX_CHECK_ERR(
ex_err,
"Error writing element block from Nemesis.");
2352 this_block_connectivity.data());
2353 EX_CHECK_ERR(
ex_err,
"Error writing element connectivities from Nemesis.");
2360 EX_CHECK_ERR(
ex_err,
"Error writing element map");
2364 EX_CHECK_ERR(
ex_err,
"Error writing element block names");
2373 const std::vector<std::string> & names,
2376 int num_vars = cast_int<int>(names.size());
2379 for (
int c=0; c<num_vars; c++)
2381 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
2382 std::vector<Real> real_parts(
num_nodes);
2383 std::vector<Real> imag_parts(
num_nodes);
2384 std::vector<Real> magnitudes(
num_nodes);
2389 real_parts[i] =
value.real();
2390 imag_parts[i] =
value.imag();
2397 std::vector<Number> cur_soln(
num_nodes);
2411 const std::vector<std::string> & names,
2413 const std::vector<std::string> & output_names)
2415 int num_vars = cast_int<int>(names.size());
2417 for (
int c=0; c<num_vars; c++)
2420 auto pos = std::find(output_names.begin(), output_names.end(), names[c]);
2423 if (pos == output_names.end())
2429 int variable_name_position =
2433 std::vector<numeric_index_type> required_indices(
num_nodes);
2440 std::vector<Number> local_soln;
2441 parallel_soln.
localize(local_soln, required_indices);
2443 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
2449 std::vector<Real> real_parts(
num_nodes);
2450 std::vector<Real> imag_parts(
num_nodes);
2451 std::vector<Real> magnitudes(
num_nodes);
2455 real_parts[i] = local_soln[i].real();
2456 imag_parts[i] = local_soln[i].imag();
2457 magnitudes[i] =
std::abs(local_soln[i]);
2471 const std::vector<std::pair<unsigned int, unsigned int>> & var_nums,
2473 const std::vector<std::string> & output_names)
2477 for (
auto & var_num : var_nums)
2479 const unsigned int sys_num = var_num.first;
2480 const unsigned int var = var_num.second;
2485 auto pos = std::find(output_names.begin(), output_names.end(),
name);
2488 if (pos == output_names.end())
2494 int variable_name_position =
2498 std::vector<numeric_index_type> required_indices(
num_nodes);
2503 std::vector<numeric_index_type> scalar_indices;
2506 required_indices[i] = scalar_indices[0];
2512 required_indices[i] = node.
dof_number(sys_num, var, 0);
2517 std::vector<Number> local_soln;
2520 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
2526 std::vector<Real> real_parts(
num_nodes);
2527 std::vector<Real> imag_parts(
num_nodes);
2528 std::vector<Real> magnitudes(
num_nodes);
2532 real_parts[i] = local_soln[i].real();
2533 imag_parts[i] = local_soln[i].imag();
2534 magnitudes[i] =
std::abs(local_soln[i]);
2549 const std::vector<std::set<subdomain_id_type>> & vars_active_subdomains)
2552 if (names.size() == 0)
2578 if (vars_active_subdomains[var].empty() ||
2580 truth_tab[names.size() * blk + var] = 1;
2583 if (truth_tab.size())
2587 cast_int<int>(names.size()),
2589 EX_CHECK_ERR(
ex_err,
"Error writing element truth table.");
2598 const std::vector<std::pair<unsigned int, unsigned int>> &var_nums,
2600 const std::vector<std::set<subdomain_id_type>> & vars_active_subdomains)
2610 const auto & active_subdomains = vars_active_subdomains[v];
2615 cast_int<subdomain_id_type>(sbd_id_int);
2617 const std::vector<dof_id_type> empty_vec;
2618 const std::vector<dof_id_type> & elem_ids =
2622 if (active_subdomains.empty() || active_subdomains.count(sbd_id))
2624 std::vector<numeric_index_type> required_indices;
2625 required_indices.reserve(elem_ids.size());
2627 const unsigned int sys_num = var_nums[v].first;
2629 for (
const auto &
id : elem_ids)
2630 required_indices.push_back
2631 (
mesh.elem_ref(
id).dof_number
2632 (sys_num, var_nums[v].second, 0));
2634 std::vector<Number> local_soln;
2635 es.
get_system(sys_num).current_local_solution->get
2636 (required_indices, local_soln);
2643 if (local_soln.size())
2647 static_cast<int>(v+1),
2648 static_cast<int>(sbd_id),
2649 static_cast<int>(local_soln.size()),
2651 EX_CHECK_ERR(
ex_err,
"Error writing element values.");
2658 EX_CHECK_ERR(
ex_err,
"Error flushing buffers to file.");
2667 std::ostringstream file_oss;
2686 unsigned int field_width = cast_int<unsigned int>(file_oss.str().size());
2689 libMesh::out <<
"field_width=" << field_width << std::endl;
2692 file_oss << base_filename
2694 <<
'.' << std::setfill(
'0') << std::setw(field_width) << this->
processor_id();
2697 return file_oss.str();
2702 #endif // #if defined(LIBMESH_HAVE_NEMESIS_API) && defined(LIBMESH_HAVE_EXODUS_API)