14 #include "boost/lexical_cast.hpp"
46 using namespace boost;
51 unsigned int sides_0 [1] = {0};
52 old_to_new_side_numbering.push_back( sides_0 );
53 unsigned int sides_1 [2] = {0,1};
54 old_to_new_side_numbering.push_back( sides_1 );
55 unsigned int sides_2 [3] = {0,1,2};
56 old_to_new_side_numbering.push_back( sides_2 );
57 unsigned int sides_3 [4] = {0,1,2,3};
58 old_to_new_side_numbering.push_back( sides_3 );
69 flow_type = std::make_shared< FieldEnum >(1);
73 flow_flux = std::make_shared< FieldScalar >(1);
75 flow_sigma = std::make_shared< FieldScalar >(1);
78 Tokenizer tok(flow_bcd);
80 double scalar, flux, sigma;
83 xprintf(
MsgLog,
"Reading old BCD file for flow: %s ...", tok.f_name().c_str());
84 tok.skip_to(
"$BoundaryConditions");
86 unsigned int n_boundaries = lexical_cast<
unsigned int>(*tok); ++tok;
88 for(
unsigned int i_bcd=0; i_bcd < n_boundaries; i_bcd++) {
91 id = lexical_cast<
unsigned int>(*tok); ++tok;
93 unsigned int type = lexical_cast<
unsigned int>(*tok); ++tok;
97 scalar = lexical_cast<
double>(*tok); ++tok;
102 flux = lexical_cast<
double>(*tok); ++tok;
107 scalar = lexical_cast<
double>(*tok); ++tok;
108 sigma = lexical_cast<
double>(*tok); ++tok;
112 xprintf(
UsrErr,
"Unknown type of boundary condition - cond # %d, type %c\n",
id, type );
116 unsigned int where = lexical_cast<
unsigned int>(*tok); ++tok;
118 unsigned int eid, sid, bc_ele_idx, our_sid;
124 eid = lexical_cast<
unsigned int>(*tok); ++tok;
125 sid = lexical_cast<
unsigned int>(*tok); ++tok;
131 if( sid < 0 || sid >= ele->
n_sides() )
132 xprintf(
UsrErr,
"Boundary %d has incorrect reference to side %d\n",
id, sid );
133 our_sid=old_to_new_side_numbering[ele->
dim()][sid];
134 bcd = ele->
side(our_sid) -> cond();
140 flow_type->set_data_row( bc_ele_idx, type);
142 flow_flux->set_data_row( bc_ele_idx, flux);
145 xprintf(
Warn,
"IGNORING boundary condition %d for non-boundary side %d of element ID: %d\n",
id, sid, eid);
177 xprintf(
UsrErr,
"Unknown entity for boundary condition - cond # %d, ent. %c\n",
id, where );
180 unsigned int n_tags = lexical_cast<
unsigned int>(*tok); ++tok;
181 while (n_tags>0) ++tok, --n_tags;
202 }
catch (bad_lexical_cast &) {
203 xprintf(
UsrErr,
"Wrong format of number, %s.\n", tok.position_msg().c_str());
211 using namespace boost;
214 trans_conc = std::make_shared< FieldVector >( n_substances );
219 Tokenizer tok(transport_bcd);
221 unsigned int bcd_id, boundary_id, bc_ele_idx;
223 xprintf(
MsgLog,
"Reading old BCD file for transport: %s ...", tok.f_name().c_str());
224 if (tok.skip_to(
"$Transport_BCDFormat")) tok.next_line(
false);
225 tok.skip_to(
"$Transport_BCD");
226 tok.next_line(
false);
227 unsigned int n_bcd = lexical_cast<
unsigned int>(*tok); ++tok;
228 for (
unsigned int i_bcd = 0; i_bcd < n_bcd; i_bcd++) {
230 bcd_id = lexical_cast<
unsigned int>(*tok); ++tok;
231 boundary_id = lexical_cast<
unsigned int>(*tok); ++tok;
235 xprintf(
UsrErr,
"Wrong boundary index %d for bcd id %d in transport bcd file!", boundary_id, bcd_id);
236 bc_ele_idx = it->second;
238 for (
unsigned int sbi = 0; sbi < n_substances; sbi++) {
239 ele_value[sbi] = lexical_cast<
double>(*tok); ++tok;
242 trans_conc->set_data_row(bc_ele_idx, ele_value);
248 }
catch (bad_lexical_cast &) {
249 xprintf(
UsrErr,
"Wrong format of number, %s.\n", tok.position_msg().c_str());