43 int main(
int argc,
char *argv[])
46 Mpi::Init(argc, argv);
47 int num_procs = Mpi::WorldSize();
48 int myid = Mpi::WorldRank();
52 const char *mesh_file =
"../data/beam-tet.mesh";
53 int ser_ref_levels = 2;
54 int par_ref_levels = 1;
57 bool visualization = 1;
58 const char *device_config =
"cpu";
61 args.
AddOption(&mesh_file,
"-m",
"--mesh",
63 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
64 "Number of times to refine the mesh uniformly in serial.");
65 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
66 "Number of times to refine the mesh uniformly in parallel.");
68 "Finite element order (polynomial degree) or -1 for"
69 " isoparametric space.");
71 "Number of desired eigenmodes.");
72 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
74 "Enable or disable GLVis visualization.");
75 args.
AddOption(&device_config,
"-d",
"--device",
76 "Device configuration string, see Device::Configure().");
93 Device device(device_config);
94 if (myid == 0) { device.
Print(); }
99 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
105 for (
int lev = 0; lev < ser_ref_levels; lev++)
116 for (
int lev = 0; lev < par_ref_levels; lev++)
128 cout <<
"Number of unknowns: " << size << endl;
200 ostringstream mesh_name, mode_name;
201 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
203 ofstream mesh_ofs(mesh_name.str().c_str());
204 mesh_ofs.precision(8);
205 pmesh->
Print(mesh_ofs);
207 for (
int i=0; i<nev; i++)
212 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
213 << setfill(
'0') << setw(6) << myid;
215 ofstream mode_ofs(mode_name.str().c_str());
216 mode_ofs.precision(8);
228 mode_sock.precision(8);
230 for (
int i=0; i<nev; i++)
234 cout <<
"Eigenmode " << i+1 <<
'/' << nev
235 <<
", Lambda = " << eigenvalues[i] << endl;
241 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
242 <<
"solution\n" << *pmesh << x << flush
243 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
244 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
249 cout <<
"press (q)uit or (c)ontinue --> " << flush;
252 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
int Size() const
Return the logical size of the array.
The Auxiliary-space Maxwell Solver in hypre.
A coefficient that is constant across space and time.
void SetMassMatrix(const HypreParMatrix &M)
Integrator for (curl u, curl v) for Nedelec elements.
HYPRE_BigInt GlobalTrueVSize() const
void SetPreconditioner(HypreSolver &precond)
virtual void Save(std::ostream &out) const
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Abstract parallel finite element space.
int close()
Close the socketstream.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void PrintUsage(std::ostream &out) const
Print the usage message.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
void SetPrintLevel(int print_lvl)
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void Solve()
Solve the eigenproblem.
void SetNumModes(int num_eigs)
const HypreParVector & GetEigenvector(unsigned int i) const
Extract a single eigenvector.
void SetMaxIter(int max_iter)
void PrintOptions(std::ostream &out) const
Print the options.
void GetEigenvalues(Array< double > &eigenvalues) const
Collect the converged eigenvalues.
void SetPrintLevel(int logging)
Arbitrary order H(curl)-conforming Nedelec finite elements.
void SetOperator(const HypreParMatrix &A)
void Print(std::ostream &out=mfem::out) const override
Class for parallel grid function.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Wrapper for hypre's ParCSR matrix class.
Class for parallel meshes.
void SetSingularProblem()
Set this option when solving a curl-curl problem with zero mass term.
bool Good() const
Return true if the command line options were parsed successfully.