39 #include "../common/mfem-common.hpp" 52 if (T.GetSpaceDim()==3)
56 T.Transform(ip, transip);
57 return std::sin(x[0])*std::cos(x[1]) +
58 std::sin(x[1])*std::cos(x[2]) +
59 std::sin(x[2])*std::cos(x[0]);
61 else if (T.GetSpaceDim()==2)
65 T.Transform(ip, transip);
66 return std::sin(x[0])*std::cos(x[1]) +
67 std::sin(x[1])*std::cos(x[0]);
73 T.Transform(ip, transip);
74 return std::sin(x)+std::cos(x);
79 int main(
int argc,
char* argv[])
86 const char *mesh_file =
"../../data/beam-tet.mesh";
87 int ser_ref_levels = 3;
88 int par_ref_levels = 1;
91 int src_num_procs = 4;
92 bool visualization =
true;
95 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
99 "Number of times to refine the mesh uniformly in serial.");
103 "Number of times to refine the mesh uniformly in parallel.");
107 "Generate input data for the transfer.");
111 "Order (degree) of the finite elements.");
115 "Number of processes for the src grid function.");
116 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
117 "--no-visualization",
118 "Enable or disable ParaView visualization.");
137 Mesh mesh(mesh_file, 1, 1);
143 for (
int lev = 0; lev < ser_ref_levels; lev++)
151 ParMesh pmesh(MPI_COMM_WORLD, mesh);
152 for (
int lev = 0; lev < par_ref_levels; lev++)
163 std::cout <<
"Number of finite element unknowns: " << glob_size
171 Coefficient* coef[2]; coef[0]=&prco; coef[1]=&prco;
177 std::ostringstream oss;
178 oss << std::setw(10) << std::setfill(
'0') << myrank;
179 std::string mname=
"mesh_"+oss.str()+
".msh";
180 std::string gname=
"gridfunc_"+oss.str()+
".gf";
203 Coefficient* coef[2]; coef[0]=&prco; coef[1]=&prco;
218 for (
int p=0;
p<src_num_procs;
p++)
220 std::ostringstream oss;
221 oss << std::setw(10) << std::setfill(
'0') <<
p;
222 std::string mname=
"mesh_"+oss.str()+
".msh";
223 std::string gname=
"gridfunc_"+oss.str()+
".gf";
227 in.open(mname.c_str(),std::ios::in);
231 in.open(gname.c_str(),std::ios::in);
261 std::cout<<
"|l2 error|="<<sqrt(l2err)<<std::endl;
Class for grid function - Vector with associated FE space.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetDataFormat(VTKFormat fmt)
void PrintOptions(std::ostream &out) const
Print the options.
Helper class for ParaView visualization data.
void PrintUsage(std::ostream &out) const
Print the usage message.
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void ParPrint(std::ostream &out) const
Save the mesh in a parallel mesh format.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
virtual void Project(const Vector &coords, const Vector &src, int ordering, double lerr)=0
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
int main(int argc, char *argv[])
virtual void Load(std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
static void Init()
Singleton creation with Mpi::Init();.
void SetTime(double t)
Set physical time (for time-dependent simulations)
HYPRE_BigInt GlobalTrueVSize() const
double p(const Vector &x, double t)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
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...
Base class for KDTreeNodalProjection.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
virtual void Save(std::ostream &out) const
double InnerProduct(HypreParVector *x, HypreParVector *y)
Class for integration point with weight.
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
void SetLevelsOfDetail(int levels_of_detail_)
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Save() override
Class for parallel grid function.
Class for parallel meshes.
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.