14 #include "boost/lexical_cast.hpp"
19 flow_pressure_factory(
41 using namespace boost;
46 unsigned int sides_0 [1] = {0};
47 old_to_new_side_numbering.push_back( sides_0 );
48 unsigned int sides_1 [2] = {0,1};
49 old_to_new_side_numbering.push_back( sides_1 );
50 unsigned int sides_2 [3] = {0,1,2};
51 old_to_new_side_numbering.push_back( sides_2 );
52 unsigned int sides_3 [4] = {0,1,2,3};
53 old_to_new_side_numbering.push_back( sides_3 );
64 flow_type = std::make_shared< FieldEnum >(1);
68 flow_flux = std::make_shared< FieldScalar >(1);
70 flow_sigma = std::make_shared< FieldScalar >(1);
73 Tokenizer tok(flow_bcd);
75 double scalar, flux, sigma;
78 xprintf(
MsgLog,
"Reading old BCD file for flow: %s ...", tok.f_name().c_str());
79 tok.skip_to(
"$BoundaryConditions");
81 unsigned int n_boundaries = lexical_cast<
unsigned int>(*tok); ++tok;
83 for(
unsigned int i_bcd=0; i_bcd < n_boundaries; i_bcd++) {
86 id = lexical_cast<
unsigned int>(*tok); ++tok;
88 unsigned int type = lexical_cast<
unsigned int>(*tok); ++tok;
92 scalar = lexical_cast<
double>(*tok); ++tok;
97 flux = lexical_cast<
double>(*tok); ++tok;
102 scalar = lexical_cast<
double>(*tok); ++tok;
103 sigma = lexical_cast<
double>(*tok); ++tok;
107 xprintf(
UsrErr,
"Unknown type of boundary condition - cond # %d, type %c\n",
id, type );
111 unsigned int where = lexical_cast<
unsigned int>(*tok); ++tok;
113 unsigned int eid, sid, bc_ele_idx, our_sid;
119 eid = lexical_cast<
unsigned int>(*tok); ++tok;
120 sid = lexical_cast<
unsigned int>(*tok); ++tok;
126 if( sid < 0 || sid >= ele->
n_sides() )
127 xprintf(
UsrErr,
"Boundary %d has incorrect reference to side %d\n",
id, sid );
128 our_sid=old_to_new_side_numbering[ele->
dim()][sid];
129 bcd = ele->
side(our_sid) -> cond();
135 flow_type->set_data_row( bc_ele_idx, type);
137 flow_flux->set_data_row( bc_ele_idx, flux);
140 xprintf(
Warn,
"IGNORING boundary condition %d for non-boundary side %d of element ID: %d\n",
id, sid, eid);
148 xprintf(
UsrErr,
"Unknown entity for boundary condition - cond # %d, ent. %c\n",
id, where );
151 unsigned int n_tags = lexical_cast<
unsigned int>(*tok); ++tok;
152 while (n_tags>0) ++tok, --n_tags;
156 }
catch (bad_lexical_cast &) {
157 xprintf(
UsrErr,
"Wrong format of number, %s.\n", tok.position_msg().c_str());
165 using namespace boost;
168 trans_conc = std::make_shared< FieldVector >( n_substances );
173 Tokenizer tok(transport_bcd);
175 unsigned int bcd_id, boundary_id, bc_ele_idx;
177 xprintf(
MsgLog,
"Reading old BCD file for transport: %s ...", tok.f_name().c_str());
178 if (tok.skip_to(
"$Transport_BCDFormat")) tok.next_line(
false);
179 tok.skip_to(
"$Transport_BCD");
180 tok.next_line(
false);
181 unsigned int n_bcd = lexical_cast<
unsigned int>(*tok); ++tok;
182 for (
unsigned int i_bcd = 0; i_bcd < n_bcd; i_bcd++) {
184 bcd_id = lexical_cast<
unsigned int>(*tok); ++tok;
185 boundary_id = lexical_cast<
unsigned int>(*tok); ++tok;
189 xprintf(
UsrErr,
"Wrong boundary index %d for bcd id %d in transport bcd file!", boundary_id, bcd_id);
190 bc_ele_idx = it->second;
192 for (
unsigned int sbi = 0; sbi < n_substances; sbi++) {
193 ele_value[sbi] = lexical_cast<
double>(*tok); ++tok;
196 trans_conc->set_data_row(bc_ele_idx, ele_value);
202 }
catch (bad_lexical_cast &) {
203 xprintf(
UsrErr,
"Wrong format of number, %s.\n", tok.position_msg().c_str());
internal::ReturnType< NRows, NCols, ET >::return_type return_type
FullIter find_id(const int id)
unsigned int n_sides() const
unsigned int index(const T *pointer) const
ElementVector bc_elements
SideIter side(const unsigned int loc_index)
Dedicated class for storing path to input and output files.
ElementFullIter element() const
bool is_valid() const
Returns false if the region has undefined/invalid value.
ElementVector element
Vector of elements of the mesh.