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;
73 args.
AddOption(&mesh_file,
"-m",
"--mesh",
76 "Finite element order (polynomial degree) or -1 for" 77 " isoparametric space.");
78 args.
AddOption(&device_config,
"-d",
"--device",
79 "Device configuration string, see Device::Configure().");
80 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
82 "Enable or disable GLVis visualization.");
83 args.
AddOption(&slu_colperm,
"-cp",
"--colperm",
84 "SuperLU Column Permutation Method: 0-NATURAL, 1-MMD-ATA " 85 "2-MMD_AT_PLUS_A, 3-COLAMD, 4-METIS_AT_PLUS_A, 5-PARMETIS " 87 args.
AddOption(&slu_rowperm,
"-rp",
"--rowperm",
88 "SuperLU Row Permutation Method: 0-NOROWPERM, 1-LargeDiag");
89 args.
AddOption(&slu_iterref,
"-ir",
"--iterref",
90 "SuperLU Iterative Refinement: 0-NOREFINE, 1-Single, " 92 args.
AddOption(&slu_npdep,
"-npdep",
"--npdepth",
93 "Depth of 3D parition for SuperLU (>= 7.2.0)");
111 Device device(device_config);
112 if (myid == 0) { device.
Print(); }
117 Mesh mesh(mesh_file, 1, 1);
126 (int)floor(log(1000./mesh.
GetNE())/log(2.)/
dim);
127 for (
int l = 0; l < ref_levels; l++)
136 ParMesh pmesh(MPI_COMM_WORLD, mesh);
139 int par_ref_levels = 2;
140 for (
int l = 0; l < par_ref_levels; l++)
162 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
174 cout <<
"Number of finite element unknowns: " << size << endl;
217 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B);
225 if (slu_colperm == 0)
229 else if (slu_colperm == 1)
233 else if (slu_colperm == 2)
237 else if (slu_colperm == 3)
241 else if (slu_colperm == 4)
245 else if (slu_colperm == 5)
249 else if (slu_colperm == 6)
254 if (slu_rowperm == 0)
258 else if (slu_rowperm == 1)
260 #ifdef MFEM_USE_SUPERLU5 267 if (slu_iterref == 0)
271 else if (slu_iterref == 1)
275 else if (slu_iterref == 2)
279 else if (slu_iterref == 3)
293 a.RecoverFEMSolution(X,
b, x);
298 ostringstream mesh_name, sol_name;
299 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
300 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
302 ofstream mesh_ofs(mesh_name.str().c_str());
303 mesh_ofs.precision(8);
304 pmesh.
Print(mesh_ofs);
306 ofstream sol_ofs(sol_name.str().c_str());
307 sol_ofs.precision(8);
317 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
318 sol_sock.precision(8);
319 sol_sock <<
"solution\n" << pmesh << x << flush;
void SetRowPermutation(superlu::RowPerm row_perm)
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.
int Dimension() const
Dimension of the reference space used within the elements.
void PrintUsage(std::ostream &out) const
Print the usage message.
Pointer to an Operator of a specified type.
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.