56 return std::sin(x[0])*std::cos(x[1]) +
57 std::sin(x[1])*std::cos(x[2]) +
58 std::sin(x[2])*std::cos(x[0]);
65 return std::sin(x[0])*std::cos(x[1]) +
66 std::sin(x[1])*std::cos(x[0]);
73 return std::sin(x)+std::cos(x);
78int main(
int argc,
char* argv[])
85 const char *mesh_file =
"../../data/beam-tet.mesh";
86 int ser_ref_levels = 3;
87 int par_ref_levels = 1;
90 int src_num_procs = 4;
91 bool visualization =
true;
94 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
98 "Number of times to refine the mesh uniformly in serial.");
102 "Number of times to refine the mesh uniformly in parallel.");
106 "Generate input data for the transfer.");
110 "Order (degree) of the finite elements.");
114 "Number of processes for the src grid function.");
115 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
116 "--no-visualization",
117 "Enable or disable ParaView visualization.");
136 Mesh mesh(mesh_file, 1, 1);
142 for (
int lev = 0; lev < ser_ref_levels; lev++)
150 ParMesh pmesh(MPI_COMM_WORLD, mesh);
151 for (
int lev = 0; lev < par_ref_levels; lev++)
162 std::cout <<
"Number of finite element unknowns: " << glob_size
170 Coefficient* coef[2]; coef[0]=&prco; coef[1]=&prco;
176 std::ostringstream oss;
177 oss << std::setw(10) << std::setfill(
'0') << myrank;
178 std::string mname=
"mesh_"+oss.str()+
".msh";
179 std::string gname=
"gridfunc_"+oss.str()+
".gf";
183 sout.open(mname.c_str(),std::ios::out);
189 sout.open(gname.c_str(),std::ios::out);
202 Coefficient* coef[2]; coef[0]=&prco; coef[1]=&prco;
217 for (
int p=0;
p<src_num_procs;
p++)
219 std::ostringstream oss;
220 oss << std::setw(10) << std::setfill(
'0') <<
p;
221 std::string mname=
"mesh_"+oss.str()+
".msh";
222 std::string gname=
"gridfunc_"+oss.str()+
".gf";
226 in.open(mname.c_str(),std::ios::in);
230 in.open(gname.c_str(),std::ios::in);
235 map->Project(gf,1e-8);
260 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_)
void SetDataFormat(VTKFormat fmt)
real_t InnerProduct(HypreParVector *x, HypreParVector *y)
real_t p(const Vector &x, real_t t)