Skip to content

Commit 05ef170

Browse files
committed
Initialize NumericVectors in AdvectionSystem::init_data()
1 parent 9e2be1a commit 05ef170

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

examples/transient/transient_ex3/advection_system.C

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ AdvectionSystem::AdvectionSystem (EquationSystems & es,
3737
_fe_order(CONSTANT),
3838
_fe_family(MONOMIAL)
3939
{
40-
// Allocate NumericVectors in _Fh. I could not figure out
41-
// how to do this in the initialization list, I don't think it's
42-
// possible.
43-
// TODO: the number of problem dimensions is hard-coded here, we should
44-
// make this depend on the input file parameters instead.
45-
for (unsigned int i=0; i<2; ++i)
46-
_Fh.push_back(NumericVector<Number>::build(es.comm()));
4740
}
4841

4942

@@ -117,8 +110,14 @@ void AdvectionSystem::init_data ()
117110

118111
Parent::init_data();
119112

120-
for (auto & vec : _Fh)
121-
vec->init (this->n_dofs(), this->n_local_dofs(), false, libMeshEnums::PARALLEL);
113+
// Allocate NumericVectors in _Fh.
114+
// TODO: the number of spatial dimensions is hard-coded here, we should
115+
// make this depend on the input file parameters instead.
116+
for (unsigned int i=0; i<2; ++i)
117+
{
118+
auto & vec = _Fh.emplace_back(NumericVector<Number>::build(this->comm()));
119+
vec->init(this->n_dofs(), this->n_local_dofs(), false, libMeshEnums::PARALLEL);
120+
}
122121
}
123122

124123
void AdvectionSystem::process_parameters_file (const std::string& parameters_filename)

0 commit comments

Comments
 (0)