frequency_system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_FREQUENCY_SYSTEM_H
21 #define LIBMESH_FREQUENCY_SYSTEM_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 // Frequency domain solutions only possible with complex arithmetic
26 #if defined(LIBMESH_USE_COMPLEX_NUMBERS)
27 
28 // Local Includes
30 
31 // C++ includes
32 #include <string>
33 #include <vector>
34 
35 namespace libMesh
36 {
37 
38 
39 
40 
66 // ------------------------------------------------------------
67 // FrequencySystem class definition
68 
70 {
71 public:
72 
78  const std::string& name,
79  const unsigned int number);
84 
91  virtual void clear ();
92 
98  void clear_all ();
99 
104  virtual void assemble ();
105 
109  virtual void solve ();
110 
119  void solve (const unsigned int n_start,
120  const unsigned int n_stop);
121 
126  virtual std::string system_type () const { return "Frequency"; }
127 
128 
129  //--------------------------------------------------------
130  // Methods specific to the FrequencySystem
131  //
132 
145  void set_frequencies_by_steps (const Real base_freq,
146  const Real freq_step=0.,
147  const unsigned int n_freq=1,
148  const bool allocate_solution_duplicates=true);
149 
159  void set_frequencies_by_range (const Real min_freq,
160  const Real max_freq,
161  const unsigned int n_freq,
162  const bool allocate_solution_duplicates=true);
163 
171  void set_frequencies (const std::vector<Real>& frequencies,
172  const bool allocate_solution_duplicates=true);
173 
177  unsigned int n_frequencies () const;
178 
185  void attach_solve_function(void fptr(EquationSystems& es,
186  const std::string& name));
187 
192  const std::string& name);
193 
197  std::pair<unsigned int, Real> get_rval (unsigned int n) const;
198 
204  std::string form_freq_param_name(const unsigned int n) const;
205 
211  std::string form_solu_vec_name(const unsigned int n) const;
212 
213 
214 protected:
215 
216 
223  virtual void init_data ();
224 
229  void set_current_frequency(unsigned int n);
230 
237 
246 
253 
267 
272  std::vector<std::pair<unsigned int, Real> > vec_rval;
273 
274 };
275 
276 
277 
278 // ------------------------------------------------------------
279 // FrequencySystem inline methods
280 inline
281 std::pair<unsigned int, Real> FrequencySystem::get_rval (unsigned int n) const
282 {
283  libmesh_assert_less (n, vec_rval.size());
284 
285  return vec_rval[n];
286 }
287 
288 
289 } // namespace libMesh
290 
291 #endif // if defined(LIBMESH_USE_COMPLEX_NUMBERS)
292 
293 #endif // LIBMESH_FREQUENCY_SYSTEM_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo