47 #ifndef MFEM_USE_SUPERLU 48 #error This example requires that MFEM is built with MFEM_USE_SUPERLU=YES 54 int main(
int argc,
char *argv[])
57 Mpi::Init(argc, argv);
58 int num_procs = Mpi::WorldSize();
59 int myid = Mpi::WorldRank();
63 const char *mesh_file =
"../../data/star.mesh";
65 const char *device_config =
"cpu";
66 bool visualization =
true;
72 args.
AddOption(&mesh_file,
"-m",
"--mesh",
75 "Finite element order (polynomial degree) or -1 for" 76 " isoparametric space.");
77 args.
AddOption(&device_config,
"-d",
"--device",
78 "Device configuration string, see Device::Configure().");
79 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
81 "Enable or disable GLVis visualization.");
82 args.
AddOption(&slu_colperm,
"-cp",
"--colperm",
83 "SuperLU Column Permutation Method: 0-NATURAL, 1-MMD-ATA " 84 "2-MMD_AT_PLUS_A, 3-COLAMD, 4-METIS_AT_PLUS_A, 5-PARMETIS " 86 args.
AddOption(&slu_rowperm,
"-rp",
"--rowperm",
87 "SuperLU Row Permutation Method: 0-NOROWPERM, 1-LargeDiag");
88 args.
AddOption(&slu_iterref,
"-rp",
"--rowperm",
89 "SuperLU Iterative Refinement: 0-NOREFINE, 1-Single, " 108 Device device(device_config);
109 if (myid == 0) { device.
Print(); }
114 Mesh mesh(mesh_file, 1, 1);
123 (int)floor(log(1000./mesh.
GetNE())/log(2.)/
dim);
124 for (
int l = 0; l < ref_levels; l++)
133 ParMesh pmesh(MPI_COMM_WORLD, mesh);
136 int par_ref_levels = 2;
137 for (
int l = 0; l < par_ref_levels; l++)
159 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
171 cout <<
"Number of finite element unknowns: " << size << endl;
214 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B);
222 if (slu_colperm == 0)
226 else if (slu_colperm == 1)
230 else if (slu_colperm == 2)
234 else if (slu_colperm == 3)
238 else if (slu_colperm == 4)
242 else if (slu_colperm == 5)
246 else if (slu_colperm == 6)
251 if (slu_rowperm == 0)
255 else if (slu_rowperm == 1)
257 #ifdef MFEM_USE_SUPERLU5 264 if (slu_iterref == 0)
268 else if (slu_iterref == 1)
272 else if (slu_iterref == 2)
276 else if (slu_iterref == 3)
291 a.RecoverFEMSolution(X,
b, x);
296 ostringstream mesh_name, sol_name;
297 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
298 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
300 ofstream mesh_ofs(mesh_name.str().c_str());
301 mesh_ofs.precision(8);
302 pmesh.
Print(mesh_ofs);
304 ofstream sol_ofs(sol_name.str().c_str());
305 sol_ofs.precision(8);
315 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
316 sol_sock.precision(8);
317 sol_sock <<
"solution\n" << pmesh << x << flush;
Class for domain integration L(v) := (f, v)
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
A coefficient that is constant across space and time.
void PrintOptions(std::ostream &out) const
Print the options.
void PrintUsage(std::ostream &out) const
Print the usage message.
Pointer to an Operator of a specified type.
void SetRowPermutation(superlu::RowPerm row_perm, Array< int > *perm=NULL)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
void SetSymmetricPattern(bool sym)
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void SetOperator(const Operator &op)
Set/update the solver for the given operator.
void SetIterativeRefine(superlu::IterRefine iter_ref)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void SetColumnPermutation(superlu::ColPerm col_perm)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
virtual const char * Name() const
void SetPrintStatistics(bool print_stat)
HYPRE_BigInt GlobalTrueVSize() const
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 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...
int main(int argc, char *argv[])
virtual void Save(std::ostream &out) const
int GetNE() const
Returns number of elements.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
int Size() const
Return the logical size of the array.
void Clear()
Clear the contents of the Mesh.
Arbitrary order H1-conforming (continuous) finite elements.
void GetNodes(Vector &node_coord) const
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.