48 int main(
int argc,
char *argv[])
52 MPI_Init(&argc, &argv);
53 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
54 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
57 const char *mesh_file =
"../data/star.mesh";
58 int ser_ref_levels = 2;
59 int par_ref_levels = 1;
62 bool slu_solver =
false;
63 bool visualization = 1;
66 args.
AddOption(&mesh_file,
"-m",
"--mesh",
68 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
69 "Number of times to refine the mesh uniformly in serial.");
70 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
71 "Number of times to refine the mesh uniformly in parallel.");
73 "Finite element order (polynomial degree) or -1 for"
74 " isoparametric space.");
76 "Number of desired eigenmodes.");
77 #ifdef MFEM_USE_SUPERLU
78 args.
AddOption(&slu_solver,
"-slu",
"--superlu",
"-no-slu",
79 "--no-superlu",
"Use the SuperLU Solver.");
81 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
83 "Enable or disable GLVis visualization.");
102 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
108 for (
int lev = 0; lev < ser_ref_levels; lev++)
119 for (
int lev = 0; lev < par_ref_levels; lev++)
144 cout <<
"Number of unknowns: " << size << endl;
185 #ifdef MFEM_USE_SUPERLU
206 #ifdef MFEM_USE_SUPERLU
239 ostringstream mesh_name, mode_name;
240 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
242 ofstream mesh_ofs(mesh_name.str().c_str());
243 mesh_ofs.precision(8);
244 pmesh->
Print(mesh_ofs);
246 for (
int i=0; i<nev; i++)
251 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
252 << setfill(
'0') << setw(6) << myid;
254 ofstream mode_ofs(mode_name.str().c_str());
255 mode_ofs.precision(8);
264 char vishost[] =
"localhost";
267 mode_sock.precision(8);
269 for (
int i=0; i<nev; i++)
273 cout <<
"Eigenmode " << i+1 <<
'/' << nev
274 <<
", Lambda = " << eigenvalues[i] << endl;
280 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
281 <<
"solution\n" << *pmesh << x << flush
282 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
283 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
288 cout <<
"press (q)uit or (c)ontinue --> " << flush;
291 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
306 #ifdef MFEM_USE_SUPERLU
int Size() const
Logical size of the array.
HypreParVector & GetEigenvector(unsigned int i)
Extract a single eigenvector.
Subclass constant coefficient.
HYPRE_Int GlobalTrueVSize()
virtual void Save(std::ostream &out) const
void SetPreconditioner(Solver &precond)
void SetMassMatrix(Operator &M)
Abstract parallel finite element space.
void SetPrintLevel(int logging)
int main(int argc, char *argv[])
void SetSymmetricPattern(bool sym)
void SetOperator(const Operator &op)
Set/update the solver for the given operator.
The BoomerAMG solver in hypre.
void SetMaxIter(int max_iter)
void SetColumnPermutation(superlu::ColPerm col_perm)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetPrintStatistics(bool print_stat)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void GetEigenvalues(Array< double > &eigenvalues)
Collect the converged eigenvalues.
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)
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
void SetOperator(Operator &A)
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
void SetPrecondUsageMode(int pcg_mode)
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
void SetNumModes(int num_eigs)
Class for parallel meshes.
void Solve()
Solve the eigenproblem.
virtual void Print(std::ostream &out=std::cout) const