MFEM  v4.1.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
complex_fem.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_COMPLEX_FEM
13 #define MFEM_COMPLEX_FEM
14 
15 #include "../linalg/complex_operator.hpp"
16 #include "gridfunc.hpp"
17 #include "linearform.hpp"
18 #include "bilinearform.hpp"
19 #ifdef MFEM_USE_MPI
20 #include "pgridfunc.hpp"
21 #include "plinearform.hpp"
22 #include "pbilinearform.hpp"
23 #endif
24 #include <complex>
25 
26 namespace mfem
27 {
28 
29 /// Class for complex-valued grid function - real + imaginary part Vector with
30 /// associated FE space.
32 {
33 private:
34  GridFunction * gfr;
35  GridFunction * gfi;
36 
37 protected:
38  void Destroy() { delete gfr; delete gfi; }
39 
40 public:
41  /* @brief Construct a ComplexGridFunction associated with the
42  FiniteElementSpace @a *f. */
44 
45  void Update();
46 
47  /// Assign constant values to the ComplexGridFunction data.
48  ComplexGridFunction &operator=(const std::complex<double> & value)
49  { *gfr = value.real(); *gfi = value.imag(); return *this; }
50 
51  virtual void ProjectCoefficient(Coefficient &real_coeff,
52  Coefficient &imag_coeff);
53  virtual void ProjectCoefficient(VectorCoefficient &real_vcoeff,
54  VectorCoefficient &imag_vcoeff);
55 
56  virtual void ProjectBdrCoefficient(Coefficient &real_coeff,
57  Coefficient &imag_coeff,
58  Array<int> &attr);
59  virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff,
60  VectorCoefficient &imag_coeff,
61  Array<int> &attr);
62  virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff,
63  VectorCoefficient &imag_coeff,
64  Array<int> &attr);
65 
66  FiniteElementSpace *FESpace() { return gfr->FESpace(); }
67  const FiniteElementSpace *FESpace() const { return gfr->FESpace(); }
68 
69  GridFunction & real() { return *gfr; }
70  GridFunction & imag() { return *gfi; }
71  const GridFunction & real() const { return *gfr; }
72  const GridFunction & imag() const { return *gfi; }
73 
74  /// Destroys the grid function.
75  virtual ~ComplexGridFunction() { Destroy(); }
76 
77 };
78 
79 /** Class for a complex-valued linear form
80 
81  The @a convention argument in the class's constructor is documented in the
82  mfem::ComplexOperator class found in linalg/complex_operator.hpp.
83 
84  When supplying integrators to the ComplexLinearForm either the real or
85  imaginary integrator can be NULL. This indicates that the corresponding
86  portion of the complex-valued field is equal to zero.
87  */
88 class ComplexLinearForm : public Vector
89 {
90 private:
92 
93 protected:
96 
97 public:
100  convention = ComplexOperator::HERMITIAN);
101 
102  /** @brief Create a ComplexLinearForm on the FiniteElementSpace @a f, using
103  the same integrators as the LinearForms @a lfr (real) and @a lfi (imag) .
104 
105  The pointer @a fes is not owned by the newly constructed object.
106 
107  The integrators are copied as pointers and they are not owned by the
108  newly constructed ComplexLinearForm. */
111  convention = ComplexOperator::HERMITIAN);
112 
113  virtual ~ComplexLinearForm();
114 
117  convention) { conv = convention; }
118 
119  /// Adds new Domain Integrator.
121  LinearFormIntegrator *lfi_imag);
122 
123  /// Adds new Boundary Integrator.
125  LinearFormIntegrator *lfi_imag);
126 
127  /** @brief Add new Boundary Integrator, restricted to the given boundary
128  attributes.
129 
130  Assumes ownership of @a lfi_real and @a lfi_imag.
131 
132  The array @a bdr_attr_marker is stored internally as a pointer to the
133  given Array<int> object. */
135  LinearFormIntegrator *lfi_imag,
136  Array<int> &bdr_attr_marker);
137 
138  /// Adds new Boundary Face Integrator. Assumes ownership of @a lfi.
140  LinearFormIntegrator *lfi_imag);
141 
142  /** @brief Add new Boundary Face Integrator, restricted to the given boundary
143  attributes.
144 
145  Assumes ownership of @a lfi_real and @a lfi_imag.
146 
147  The array @a bdr_attr_marker is stored internally as a pointer to the
148  given Array<int> object. */
150  LinearFormIntegrator *lfi_imag,
151  Array<int> &bdr_attr_marker);
152 
153  FiniteElementSpace *FESpace() const { return lfr->FESpace(); }
154 
155  LinearForm & real() { return *lfr; }
156  LinearForm & imag() { return *lfi; }
157  const LinearForm & real() const { return *lfr; }
158  const LinearForm & imag() const { return *lfi; }
159 
160  void Update();
161  void Update(FiniteElementSpace *f);
162 
163  /// Assembles the linear form i.e. sums over all domain/bdr integrators.
164  void Assemble();
165 
166  std::complex<double> operator()(const ComplexGridFunction &gf) const;
167 };
168 
169 
170 /** Class for sesquilinear form
171 
172  A sesquilinear form is a generalization of a bilinear form to complex-valued
173  fields. Sesquilinear forms are linear in the second argument but the first
174  argument involves a complex conjugate in the sense that:
175 
176  a(alpha u, beta v) = conj(alpha) beta a(u, v)
177 
178  The @a convention argument in the class's constructor is documented in the
179  mfem::ComplexOperator class found in linalg/complex_operator.hpp.
180 
181  When supplying integrators to the SesquilinearForm either the real or
182  imaginary integrator can be NULL. This indicates that the corresponding
183  portion of the complex-valued material coefficient is equal to zero.
184 */
186 {
187 private:
189 
190  /** This data member allows one to specify what should be done to the
191  diagonal matrix entries and corresponding RHS values upon elimination of
192  the constrained DoFs. */
194 
195  BilinearForm *blfr;
196  BilinearForm *blfi;
197 
198  /* These methods check if the real/imag parts of the sesqulinear form are not
199  empty */
200  bool RealInteg();
201  bool ImagInteg();
202 
203 public:
206  convention = ComplexOperator::HERMITIAN);
207  /** @brief Create a SesquilinearForm on the FiniteElementSpace @a f, using
208  the same integrators as the BilinearForms @a bfr and @a bfi .
209 
210  The pointer @a fes is not owned by the newly constructed object.
211 
212  The integrators are copied as pointers and they are not owned by the
213  newly constructed SesquilinearForm. */
216  convention = ComplexOperator::HERMITIAN);
217 
220  convention) { conv = convention; }
221 
222  BilinearForm & real() { return *blfr; }
223  BilinearForm & imag() { return *blfi; }
224  const BilinearForm & real() const { return *blfr; }
225  const BilinearForm & imag() const { return *blfi; }
226 
227  /// Adds new Domain Integrator.
229  BilinearFormIntegrator *bfi_imag);
230 
231  /// Adds new Boundary Integrator.
233  BilinearFormIntegrator *bfi_imag);
234 
235  /// Adds new Boundary Integrator, restricted to specific boundary attributes.
237  BilinearFormIntegrator *bfi_imag,
238  Array<int> &bdr_marker);
239 
240  /// Adds new interior Face Integrator. Assumes ownership of @a bfi.
242  BilinearFormIntegrator *bfi_imag);
243 
244  /// Adds new boundary Face Integrator. Assumes ownership of @a bfi.
246  BilinearFormIntegrator *bfi_imag);
247 
248  /** @brief Adds new boundary Face Integrator, restricted to specific boundary
249  attributes.
250 
251  Assumes ownership of @a bfi.
252 
253  The array @a bdr_marker is stored internally as a pointer to the given
254  Array<int> object. */
256  BilinearFormIntegrator *bfi_imag,
257  Array<int> &bdr_marker);
258 
259  /// Assemble the local matrix
260  void Assemble(int skip_zeros = 1);
261 
262  /// Finalizes the matrix initialization.
263  void Finalize(int skip_zeros = 1);
264 
265  /// Returns the matrix assembled on the true dofs, i.e. P^t A P.
266  /** The returned matrix has to be deleted by the caller. */
268 
269  /// Return the parallel FE space associated with the ParBilinearForm.
270  FiniteElementSpace *FESpace() const { return blfr->FESpace(); }
271 
272  void FormLinearSystem(const Array<int> &ess_tdof_list, Vector &x, Vector &b,
273  OperatorHandle &A, Vector &X, Vector &B,
274  int copy_interior = 0);
275 
276  void FormSystemMatrix(const Array<int> &ess_tdof_list,
277  OperatorHandle &A);
278 
279  /** Call this method after solving a linear system constructed using the
280  FormLinearSystem method to recover the solution as a ParGridFunction-size
281  vector in x. Use the same arguments as in the FormLinearSystem call. */
282  virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
283 
284  virtual void Update(FiniteElementSpace *nfes = NULL);
285 
286  /// Sets diagonal policy used upon construction of the linear system
288 
289  /// Returns the diagonal policy of the sesquilinear form
290  Matrix::DiagonalPolicy GetDiagonalPolicy() const {return diag_policy;}
291 
292  virtual ~SesquilinearForm();
293 };
294 
295 #ifdef MFEM_USE_MPI
296 
297 /// Class for parallel complex-valued grid function - real + imaginary part
298 /// Vector with associated parallel FE space.
300 {
301 private:
302 
303  ParGridFunction * pgfr;
304  ParGridFunction * pgfi;
305 
306 protected:
307  void Destroy() { delete pgfr; delete pgfi; }
308 
309 public:
310 
311  /* @brief Construct a ParComplexGridFunction associated with the
312  ParFiniteElementSpace @a *f. */
314 
315  void Update();
316 
317  /// Assign constant values to the ParComplexGridFunction data.
318  ParComplexGridFunction &operator=(const std::complex<double> & value)
319  { *pgfr = value.real(); *pgfi = value.imag(); return *this; }
320 
321  virtual void ProjectCoefficient(Coefficient &real_coeff,
322  Coefficient &imag_coeff);
323  virtual void ProjectCoefficient(VectorCoefficient &real_vcoeff,
324  VectorCoefficient &imag_vcoeff);
325 
326  virtual void ProjectBdrCoefficient(Coefficient &real_coeff,
327  Coefficient &imag_coeff,
328  Array<int> &attr);
329  virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff,
330  VectorCoefficient &imag_coeff,
331  Array<int> &attr);
332  virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff,
333  VectorCoefficient &imag_coeff,
334  Array<int> &attr);
335 
336  void Distribute(const Vector *tv);
337  void Distribute(const Vector &tv) { Distribute(&tv); }
338 
339  /// Returns the vector restricted to the true dofs.
340  void ParallelProject(Vector &tv) const;
341 
342  FiniteElementSpace *FESpace() { return pgfr->FESpace(); }
343  const FiniteElementSpace *FESpace() const { return pgfr->FESpace(); }
344 
346  const ParFiniteElementSpace *ParFESpace() const { return pgfr->ParFESpace(); }
347 
348  ParGridFunction & real() { return *pgfr; }
349  ParGridFunction & imag() { return *pgfi; }
350  const ParGridFunction & real() const { return *pgfr; }
351  const ParGridFunction & imag() const { return *pgfi; }
352 
353  virtual double ComputeL2Error(Coefficient &exsolr, Coefficient &exsoli,
354  const IntegrationRule *irs[] = NULL) const
355  {
356  double err_r = pgfr->ComputeL2Error(exsolr, irs);
357  double err_i = pgfi->ComputeL2Error(exsoli, irs);
358  return sqrt(err_r * err_r + err_i * err_i);
359  }
360 
361  virtual double ComputeL2Error(VectorCoefficient &exsolr,
362  VectorCoefficient &exsoli,
363  const IntegrationRule *irs[] = NULL,
364  Array<int> *elems = NULL) const
365  {
366  double err_r = pgfr->ComputeL2Error(exsolr, irs, elems);
367  double err_i = pgfi->ComputeL2Error(exsoli, irs, elems);
368  return sqrt(err_r * err_r + err_i * err_i);
369  }
370 
371 
372  /// Destroys grid function.
374 
375 };
376 
377 /** Class for a complex-valued, parallel linear form
378 
379  The @a convention argument in the class's constructor is documented in the
380  mfem::ComplexOperator class found in linalg/complex_operator.hpp.
381 
382  When supplying integrators to the ParComplexLinearForm either the real or
383  imaginary integrator can be NULL. This indicates that the corresponding
384  portion of the complex-valued field is equal to zero.
385  */
387 {
388 private:
390 
391 protected:
394 
395  HYPRE_Int * tdof_offsets;
396 
397 public:
398 
401  convention = ComplexOperator::HERMITIAN);
402 
403  /** @brief Create a ParComplexLinearForm on the ParFiniteElementSpace @a pf,
404  using the same integrators as the LinearForms @a plfr (real) and @a plfi
405  (imag) .
406 
407  The pointer @a fes is not owned by the newly constructed object.
408 
409  The integrators are copied as pointers and they are not owned by the newly
410  constructed ParComplexLinearForm. */
412  ParLinearForm *plf_i,
414  convention = ComplexOperator::HERMITIAN);
415 
416  virtual ~ParComplexLinearForm();
417 
420  convention) { conv = convention; }
421 
422  /// Adds new Domain Integrator.
424  LinearFormIntegrator *lfi_imag);
425 
426  /// Adds new Boundary Integrator.
428  LinearFormIntegrator *lfi_imag);
429 
430  /** @brief Add new Boundary Integrator, restricted to the given boundary
431  attributes.
432 
433  Assumes ownership of @a lfi_real and @a lfi_imag.
434 
435  The array @a bdr_attr_marker is stored internally as a pointer to the
436  given Array<int> object. */
438  LinearFormIntegrator *lfi_imag,
439  Array<int> &bdr_attr_marker);
440 
441  /// Adds new Boundary Face Integrator. Assumes ownership of @a lfi.
443  LinearFormIntegrator *lfi_imag);
444 
445  /** @brief Add new Boundary Face Integrator, restricted to the given boundary
446  attributes.
447 
448  Assumes ownership of @a lfi_real and @a lfi_imag.
449 
450  The array @a bdr_attr_marker is stored internally as a pointer to the
451  given Array<int> object. */
453  LinearFormIntegrator *lfi_imag,
454  Array<int> &bdr_attr_marker);
455 
457 
458  ParLinearForm & real() { return *plfr; }
459  ParLinearForm & imag() { return *plfi; }
460  const ParLinearForm & real() const { return *plfr; }
461  const ParLinearForm & imag() const { return *plfi; }
462 
463  void Update(ParFiniteElementSpace *pf = NULL);
464 
465  /// Assembles the linear form i.e. sums over all domain/bdr integrators.
466  void Assemble();
467 
468  /// Assemble the vector on the true dofs, i.e. P^t v.
469  void ParallelAssemble(Vector &tv);
470 
471  /// Returns the vector assembled on the true dofs, i.e. P^t v.
473 
474  std::complex<double> operator()(const ParComplexGridFunction &gf) const;
475 
476 };
477 
478 /** Class for a parallel sesquilinear form
479 
480  A sesquilinear form is a generalization of a bilinear form to complex-valued
481  fields. Sesquilinear forms are linear in the second argument but but the
482  first argument involves a complex conjugate in the sense that:
483 
484  a(alpha u, beta v) = conj(alpha) beta a(u, v)
485 
486  The @a convention argument in the class's constructor is documented in the
487  mfem::ComplexOperator class found in linalg/complex_operator.hpp.
488 
489  When supplying integrators to the ParSesquilinearForm either the real or
490  imaginary integrator can be NULL. This indicates that the corresponding
491  portion of the complex-valued material coefficient is equal to zero.
492 */
494 {
495 private:
497 
498  ParBilinearForm *pblfr;
499  ParBilinearForm *pblfi;
500 
501  /* These methods check if the real/imag parts of the sesqulinear form are not
502  empty */
503  bool RealInteg();
504  bool ImagInteg();
505 
506 public:
509  convention = ComplexOperator::HERMITIAN);
510 
511  /** @brief Create a ParSesquilinearForm on the ParFiniteElementSpace @a pf,
512  using the same integrators as the ParBilinearForms @a pbfr and @a pbfi .
513 
514  The pointer @a pf is not owned by the newly constructed object.
515 
516  The integrators are copied as pointers and they are not owned by the
517  newly constructed ParSesquilinearForm. */
519  ParBilinearForm *pbfi,
521  convention = ComplexOperator::HERMITIAN);
522 
525  convention) { conv = convention; }
526 
527  ParBilinearForm & real() { return *pblfr; }
528  ParBilinearForm & imag() { return *pblfi; }
529  const ParBilinearForm & real() const { return *pblfr; }
530  const ParBilinearForm & imag() const { return *pblfi; }
531 
532  /// Adds new Domain Integrator.
534  BilinearFormIntegrator *bfi_imag);
535 
536  /// Adds new Boundary Integrator.
538  BilinearFormIntegrator *bfi_imag);
539 
540  /** @brief Adds new boundary Integrator, restricted to specific boundary
541  attributes.
542 
543  Assumes ownership of @a bfi.
544 
545  The array @a bdr_marker is stored internally as a pointer to the given
546  Array<int> object. */
548  BilinearFormIntegrator *bfi_imag,
549  Array<int> &bdr_marker);
550 
551  /// Adds new interior Face Integrator. Assumes ownership of @a bfi.
553  BilinearFormIntegrator *bfi_imag);
554 
555  /// Adds new boundary Face Integrator. Assumes ownership of @a bfi.
557  BilinearFormIntegrator *bfi_imag);
558 
559  /** @brief Adds new boundary Face Integrator, restricted to specific boundary
560  attributes.
561 
562  Assumes ownership of @a bfi.
563 
564  The array @a bdr_marker is stored internally as a pointer to the given
565  Array<int> object. */
567  BilinearFormIntegrator *bfi_imag,
568  Array<int> &bdr_marker);
569 
570  /// Assemble the local matrix
571  void Assemble(int skip_zeros = 1);
572 
573  /// Finalizes the matrix initialization.
574  void Finalize(int skip_zeros = 1);
575 
576  /// Returns the matrix assembled on the true dofs, i.e. P^t A P.
577  /** The returned matrix has to be deleted by the caller. */
579 
580  /// Return the parallel FE space associated with the ParBilinearForm.
581  ParFiniteElementSpace *ParFESpace() const { return pblfr->ParFESpace(); }
582 
583  void FormLinearSystem(const Array<int> &ess_tdof_list, Vector &x, Vector &b,
584  OperatorHandle &A, Vector &X, Vector &B,
585  int copy_interior = 0);
586 
587  void FormSystemMatrix(const Array<int> &ess_tdof_list,
588  OperatorHandle &A);
589 
590  /** Call this method after solving a linear system constructed using the
591  FormLinearSystem method to recover the solution as a ParGridFunction-size
592  vector in x. Use the same arguments as in the FormLinearSystem call. */
593  virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
594 
595  virtual void Update(FiniteElementSpace *nfes = NULL);
596 
597  virtual ~ParSesquilinearForm();
598 };
599 
600 #endif // MFEM_USE_MPI
601 
602 }
603 
604 #endif // MFEM_COMPLEX_FEM
void SetConvention(const ComplexOperator::Convention &convention)
ParFiniteElementSpace * ParFESpace() const
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
ComplexOperator::Convention GetConvention() const
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:27
const ParLinearForm & imag() const
void SetDiagonalPolicy(mfem::Matrix::DiagonalPolicy dpolicy)
Sets diagonal policy used upon construction of the linear system.
const GridFunction & imag() const
Definition: complex_fem.hpp:72
void FormSystemMatrix(const Array< int > &ess_tdof_list, OperatorHandle &A)
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
ParBilinearForm & real()
FiniteElementSpace * FESpace()
Return the FE space associated with the BilinearForm.
ComplexSparseMatrix * AssembleComplexSparseMatrix()
Returns the matrix assembled on the true dofs, i.e. P^t A P.
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
Definition: complex_fem.cpp:76
const LinearForm & real() const
void SetConvention(const ComplexOperator::Convention &convention)
Pointer to an Operator of a specified type.
Definition: handle.hpp:33
void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
FiniteElementSpace * FESpace()
void AddDomainIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Domain Integrator.
void AddDomainIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Domain Integrator.
ParGridFunction & imag()
virtual double ComputeL2Error(Coefficient &exsolr, Coefficient &exsoli, const IntegrationRule *irs[]=NULL) const
Abstract parallel finite element space.
Definition: pfespace.hpp:28
HypreParVector * ParallelAssemble()
Returns the vector assembled on the true dofs, i.e. P^t v.
const GridFunction & real() const
Definition: complex_fem.hpp:71
ParBilinearForm & imag()
const ParFiniteElementSpace * ParFESpace() const
ParComplexLinearForm(ParFiniteElementSpace *pf, ComplexOperator::Convention convention=ComplexOperator::HERMITIAN)
Abstract base class LinearFormIntegrator.
Definition: lininteg.hpp:22
ParLinearForm & imag()
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
FiniteElementSpace * FESpace()
Read+write access to the associated FiniteElementSpace.
Definition: linearform.hpp:106
std::complex< double > operator()(const ComplexGridFunction &gf) const
FiniteElementSpace * FESpace() const
void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B, int copy_interior=0)
ComplexLinearForm(FiniteElementSpace *fes, ComplexOperator::Convention convention=ComplexOperator::HERMITIAN)
ParFiniteElementSpace * ParFESpace()
SesquilinearForm(FiniteElementSpace *fes, ComplexOperator::Convention convention=ComplexOperator::HERMITIAN)
const BilinearForm & imag() const
const ParBilinearForm & imag() const
ParSesquilinearForm(ParFiniteElementSpace *pf, ComplexOperator::Convention convention=ComplexOperator::HERMITIAN)
ParComplexGridFunction & operator=(const std::complex< double > &value)
Assign constant values to the ParComplexGridFunction data.
ComplexHypreParMatrix * ParallelAssemble()
Returns the matrix assembled on the true dofs, i.e. P^t A P.
Class for parallel linear form.
Definition: plinearform.hpp:26
const ParBilinearForm & real() const
void Distribute(const Vector &tv)
void AddBdrFaceIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new boundary Face Integrator. Assumes ownership of bfi.
ComplexGridFunction(FiniteElementSpace *f)
Definition: complex_fem.cpp:19
ParFiniteElementSpace * ParFESpace() const
Return the parallel FE space associated with the ParBilinearForm.
double b
Definition: lissajous.cpp:42
ParFiniteElementSpace * ParFESpace() const
Definition: plinearform.hpp:76
virtual void ProjectBdrCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff, Array< int > &attr)
Definition: complex_fem.cpp:92
virtual double ComputeL2Error(VectorCoefficient &exsolr, VectorCoefficient &exsoli, const IntegrationRule *irs[]=NULL, Array< int > *elems=NULL) const
virtual ~ComplexGridFunction()
Destroys the grid function.
Definition: complex_fem.hpp:75
void FormSystemMatrix(const Array< int > &ess_tdof_list, OperatorHandle &A)
void Update(ParFiniteElementSpace *pf=NULL)
void SetConvention(const ComplexOperator::Convention &convention)
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
FiniteElementSpace * FESpace() const
Return the parallel FE space associated with the ParBilinearForm.
GridFunction & real()
Definition: complex_fem.hpp:69
FiniteElementSpace * FESpace()
Definition: gridfunc.hpp:442
Set the diagonal value to one.
Definition: matrix.hpp:35
ComplexOperator::Convention GetConvention() const
BilinearForm & real()
Wrapper for hypre&#39;s parallel vector class.
Definition: hypre.hpp:73
void Distribute(const Vector *tv)
void SetConvention(const ComplexOperator::Convention &convention)
void AddInteriorFaceIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new interior Face Integrator. Assumes ownership of bfi.
virtual void ProjectBdrCoefficientNormal(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
Abstract base class BilinearFormIntegrator.
Definition: bilininteg.hpp:24
void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
Specialization of the ComplexOperator built from a pair of Sparse Matrices.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
GridFunction & imag()
Definition: complex_fem.hpp:70
Base class Coefficient that may optionally depend on time.
Definition: coefficient.hpp:31
BilinearForm & imag()
void AddBoundaryIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new Boundary Integrator.
virtual ~ParComplexGridFunction()
Destroys grid function.
const LinearForm & imag() const
const BilinearForm & real() const
void AddBoundaryIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Boundary Integrator.
std::complex< double > operator()(const ParComplexGridFunction &gf) const
ParComplexGridFunction(ParFiniteElementSpace *pf)
ParLinearForm & real()
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x)
void AddDomainIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new Domain Integrator.
FiniteElementSpace * FESpace()
Definition: complex_fem.hpp:66
void Assemble()
Assembles the linear form i.e. sums over all domain/bdr integrators.
void AddBdrFaceIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Boundary Face Integrator. Assumes ownership of lfi.
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &real_coeff, VectorCoefficient &imag_coeff, Array< int > &attr)
void Assemble(int skip_zeros=1)
Assemble the local matrix.
virtual double ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const
Definition: pgridfunc.hpp:250
void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B, int copy_interior=0)
const ParGridFunction & imag() const
const ParLinearForm & real() const
void Assemble(int skip_zeros=1)
Assemble the local matrix.
Specialization of the ComplexOperator built from a pair of HypreParMatrices.
Native convention for Hermitian operators.
void AddDomainIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new Domain Integrator.
Class for parallel bilinear form.
const FiniteElementSpace * FESpace() const
Definition: complex_fem.hpp:67
Vector data type.
Definition: vector.hpp:48
const FiniteElementSpace * FESpace() const
const ParGridFunction & real() const
virtual void Update(FiniteElementSpace *nfes=NULL)
ComplexOperator::Convention GetConvention() const
void AddBdrFaceIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new boundary Face Integrator. Assumes ownership of bfi.
ParGridFunction & real()
Class for linear form - Vector with associated FE space and LFIntegrators.
Definition: linearform.hpp:23
ComplexGridFunction & operator=(const std::complex< double > &value)
Assign constant values to the ComplexGridFunction data.
Definition: complex_fem.hpp:48
void AddBdrFaceIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Boundary Face Integrator. Assumes ownership of lfi.
Class for parallel grid function.
Definition: pgridfunc.hpp:32
ParFiniteElementSpace * ParFESpace() const
Return the parallel FE space associated with the ParBilinearForm.
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
void Assemble()
Assembles the linear form i.e. sums over all domain/bdr integrators.
void AddBoundaryIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new Boundary Integrator.
virtual void Update(FiniteElementSpace *nfes=NULL)
void AddInteriorFaceIntegrator(BilinearFormIntegrator *bfi_real, BilinearFormIntegrator *bfi_imag)
Adds new interior Face Integrator. Assumes ownership of bfi.
void AddBoundaryIntegrator(LinearFormIntegrator *lfi_real, LinearFormIntegrator *lfi_imag)
Adds new Boundary Integrator.
ComplexOperator::Convention GetConvention() const
virtual void ProjectCoefficient(Coefficient &real_coeff, Coefficient &imag_coeff)
ParFiniteElementSpace * ParFESpace() const
Definition: pgridfunc.hpp:103
Matrix::DiagonalPolicy GetDiagonalPolicy() const
Returns the diagonal policy of the sesquilinear form.