47 int main(
int argc,
char *argv[])
51 MPI_Init(&argc, &argv);
52 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
53 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
56 const char *mesh_file =
"../data/star.mesh";
57 int ser_ref_levels = 2;
58 int par_ref_levels = 1;
61 bool visualization = 1;
64 args.
AddOption(&mesh_file,
"-m",
"--mesh",
66 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
67 "Number of times to refine the mesh uniformly in serial.");
68 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
69 "Number of times to refine the mesh uniformly in parallel.");
71 "Finite element order (polynomial degree) or -1 for"
72 " isoparametric space.");
74 "Number of desired eigenmodes.");
75 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
77 "Enable or disable GLVis visualization.");
97 ifstream imesh(mesh_file);
102 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
107 mesh =
new Mesh(imesh, 1, 1);
114 for (
int lev = 0; lev < ser_ref_levels; lev++)
125 for (
int lev = 0; lev < par_ref_levels; lev++)
150 cout <<
"Number of unknowns: " << size << endl;
221 ostringstream mesh_name, mode_name;
222 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
224 ofstream mesh_ofs(mesh_name.str().c_str());
225 mesh_ofs.precision(8);
226 pmesh->
Print(mesh_ofs);
228 for (
int i=0; i<nev; i++)
233 mode_name <<
"mode_" << setfill(
'0') << setw(2) << i <<
"."
234 << setfill(
'0') << setw(6) << myid;
236 ofstream mode_ofs(mode_name.str().c_str());
237 mode_ofs.precision(8);
246 char vishost[] =
"localhost";
249 mode_sock.precision(8);
251 for (
int i=0; i<nev; i++)
255 cout <<
"Eigenmode " << i+1 <<
'/' << nev
256 <<
", Lambda = " << eigenvalues[i] << endl;
262 mode_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n"
263 <<
"solution\n" << *pmesh << x << flush
264 <<
"window_title 'Eigenmode " << i+1 <<
'/' << nev
265 <<
", Lambda = " << eigenvalues[i] <<
"'" << endl;
270 cout <<
"press (q)uit or (c)ontinue --> " << flush;
273 MPI_Bcast(&c, 1, MPI_CHAR, 0, MPI_COMM_WORLD);
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)
The BoomerAMG solver in hypre.
void SetMaxIter(int max_iter)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
int main(int argc, char *argv[])
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