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]);
66 return std::sin(x[0])*std::cos(x[1]) +
67 std::sin(x[1])*std::cos(x[0]);
74 return std::sin(x)+std::cos(x);
79int 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";
184 sout.open(mname.c_str(),std::ios::out);
190 sout.open(gname.c_str(),std::ios::out);
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);
236 map->Project(gf,1e-8);
261 std::cout<<
"|l2 error|="<<sqrt(l2err)<<std::endl;
Base class for KDTreeNodalProjection.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetTime(real_t t)
Set physical time (for time-dependent simulations)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
Class for grid function - Vector with associated FE space.
Arbitrary order H1-conforming (continuous) finite elements.
Class for integration point with weight.
virtual void Load(std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
HYPRE_BigInt GlobalTrueVSize() const
Class for parallel grid function.
void Save(std::ostream &out) const override
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
Class for parallel meshes.
void ParPrint(std::ostream &out, const std::string &comments="") const
Helper class for ParaView visualization data.
void SetLevelsOfDetail(int levels_of_detail_)
virtual void Save() override
void SetDataFormat(VTKFormat fmt)
real_t InnerProduct(HypreParVector *x, HypreParVector *y)
real_t p(const Vector &x, real_t t)