26 #if defined(LIBMESH_USE_COMPLEX_NUMBERS) 47 const std::string & name_in,
48 const unsigned int number_in) :
50 solve_system (nullptr),
51 _finished_set_frequencies (false),
52 _keep_solution_duplicates (true),
53 _finished_init (false),
54 _finished_assemble (false)
107 unsigned int n_freq = es.
parameters.
get<
unsigned int>(
"n_frequencies");
108 for (
unsigned int n=0; n < n_freq; n++)
123 LOG_SCOPE(
"init()",
"FrequencySystem");
139 const unsigned int n_freq =
142 libmesh_assert_greater (n_freq, 0);
149 libmesh_error_msg(
"ERROR: Need to set frequencies before calling init().");
162 libmesh_error_msg(
"ERROR: Matrices already assembled.");
165 LOG_SCOPE(
"assemble()",
"FrequencySystem");
182 const unsigned int n_freq,
183 const bool allocate_solution_duplicates)
189 libmesh_error_msg(
"ERROR: frequencies already initialized.");
197 for (
unsigned int n=0; n<n_freq; n++)
201 base_freq +
Number(n) * freq_step;
218 const unsigned int n_freq,
219 const bool allocate_solution_duplicates)
224 libmesh_assert_greater_equal (std::real(max_freq), std::real(min_freq));
225 libmesh_assert_greater (n_freq, 0);
228 libmesh_error_msg(
"ERROR: frequencies already initialized.");
237 for (
unsigned int n=0; n<n_freq; n++)
241 min_freq + static_cast<Number>(n)*(max_freq-min_freq)/static_cast<Number>(n_freq-1);
257 const bool allocate_solution_duplicates)
259 libmesh_deprecated();
263 libmesh_assert(!frequencies.empty());
266 libmesh_error_msg(
"ERROR: frequencies already initialized.");
272 es.
parameters.
set<
unsigned int>(
"n_frequencies") = frequencies.size();
275 for (std::size_t n=0; n<frequencies.size(); n++)
293 const bool allocate_solution_duplicates)
295 libmesh_deprecated();
299 libmesh_assert(!frequencies.empty());
302 libmesh_error_msg(
"ERROR: frequencies already initialized.");
308 es.
parameters.
set<
unsigned int>(
"n_frequencies") = frequencies.size();
311 for (std::size_t n=0; n<frequencies.size(); n++)
349 const unsigned int n_stop)
370 const unsigned int maxits =
371 es.
parameters.
get<
unsigned int>(
"linear solver maximum iterations");
378 for (
unsigned int n=n_start; n<= n_stop; n++)
384 START_LOG(
"user_pre_solve()",
"FrequencySystem");
388 STOP_LOG(
"user_pre_solve()",
"FrequencySystem");
392 const std::pair<unsigned int, Real> rval =
416 const std::string &
name))
418 libmesh_assert(fptr);
440 libmesh_assert_less (n, 9999);
442 sprintf(buf,
"frequency %04u", n);
450 libmesh_assert_less (n, 9999);
452 sprintf(buf,
"solution %04u", n);
459 #endif // if defined(LIBMESH_USE_COMPLEX_NUMBERS) std::string name(const ElemQuality q)
void attach_solve_function(void fptr(EquationSystems &es, const std::string &name))
virtual void assemble() override
virtual void solve() override
Manages multiples systems of equations.
void(* solve_system)(EquationSystems &es, const std::string &name)
virtual void assemble() override
unsigned int _n_linear_iterations
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
const EquationSystems & get_equation_systems() const
bool _keep_solution_duplicates
std::unique_ptr< LinearSolver< Number > > linear_solver
NumericVector< Number > * rhs
void set_frequencies_by_range(const Number min_freq, const Number max_freq, const unsigned int n_freq, const bool allocate_solution_duplicates=true)
void set_frequencies(const std::vector< Real > &frequencies, const bool allocate_solution_duplicates=true)
std::string form_freq_param_name(const unsigned int n) const
FrequencySystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
virtual void init_data() override
virtual void init_data() override
const NumericVector< Number > & get_vector(const std::string &vec_name) const
std::unique_ptr< NumericVector< Number > > solution
void remove(const std::string &)
void set_frequencies_by_steps(const Number base_freq, const Number freq_step=0., const unsigned int n_freq=1, const bool allocate_solution_duplicates=true)
Real _final_linear_residual
virtual void clear() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int n_frequencies() const
T & set(const std::string &)
SparseMatrix< Number > * matrix
const T & get(const std::string &) const
bool _finished_set_frequencies
void set_current_frequency(unsigned int n)
virtual void clear() override
const std::string & name() const
bool have_parameter(const std::string &) const
std::string form_solu_vec_name(const unsigned int n) const
std::vector< std::pair< unsigned int, Real > > vec_rval