53 int main(
int argc,
char *argv[])
56 Mpi::Init(argc, argv);
60 const char *mesh_file =
"../../data/ref-cube.mesh";
63 int num_parallel_refs = 3;
64 int number_of_particles = 3;
77 double uniform_min = 0.0;
78 double uniform_max = 1.0;
81 double level_set_threshold = 0.0;
82 bool paraview_export =
true;
83 bool glvis_export =
true;
84 bool uniform_rf =
false;
85 bool random_seed =
true;
86 bool compute_boundary_integrals =
false;
89 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
91 "Finite element order (polynomial degree) or -1 for" 92 " isoparametric space.");
93 args.
AddOption(&num_refs,
"-r",
"--refs",
"Number of uniform refinements");
94 args.
AddOption(&num_parallel_refs,
"-rp",
"--refs-parallel",
95 "Number of uniform refinements");
96 args.
AddOption(&topological_support,
"-top",
"--topology",
97 "Topological support. 0 particles, 1 octet-truss");
98 args.
AddOption(&nu,
"-nu",
"--nu",
"Fractional exponent nu (smoothness)");
99 args.
AddOption(&tau,
"-t",
"--tau",
"Parameter for topology generation");
101 "First component of diagonal core of theta");
103 "Second component of diagonal core of theta");
105 "Third component of diagonal core of theta");
106 args.
AddOption(&e1,
"-e1",
"--e1",
"First euler angle for rotation of theta");
108 "Second euler angle for rotation of theta");
109 args.
AddOption(&e3,
"-e3",
"--e3",
"Third euler angle for rotation of theta");
110 args.
AddOption(&pl1,
"-pl1",
"--pl1",
"Length scale 1 of particles");
111 args.
AddOption(&pl2,
"-pl2",
"--pl2",
"Length scale 2 of particles");
112 args.
AddOption(&pl3,
"-pl3",
"--pl3",
"Length scale 3 of particles");
113 args.
AddOption(&uniform_min,
"-umin",
"--uniform-min",
114 "Minimum value of uniform distribution");
115 args.
AddOption(&uniform_max,
"-umax",
"--uniform-max",
116 "Maximum value of uniform distribution");
117 args.
AddOption(&offset,
"-off",
"--offset",
118 "Offset for random field u(x) -> u(x) + a");
120 "Scale for random field u(x) -> a * u(x)");
121 args.
AddOption(&level_set_threshold,
"-lst",
"--level-set-threshold",
122 "Level set threshold");
123 args.
AddOption(&number_of_particles,
"-n",
"--number-of-particles",
124 "Number of particles");
125 args.
AddOption(¶view_export,
"-pvis",
"--paraview-visualization",
126 "-no-pvis",
"--no-paraview-visualization",
127 "Enable or disable ParaView visualization.");
128 args.
AddOption(&glvis_export,
"-vis",
"--visualization",
"-no-vis",
129 "--no-visualization",
130 "Enable or disable GLVis visualization.");
131 args.
AddOption(&uniform_rf,
"-urf",
"--uniform-rf",
"-no-urf",
133 "Enable or disable the transformation of GRF to URF.");
134 args.
AddOption(&random_seed,
"-rs",
"--random-seed",
"-no-rs",
135 "--no-random-seed",
"Enable or disable random seed.");
136 args.
AddOption(&compute_boundary_integrals,
"-cbi",
137 "--compute-boundary-integrals",
"-no-cbi",
138 "--no-compute-boundary-integrals",
139 "Enable or disable computation of boundary integrals.");
152 Mesh mesh(mesh_file, 1, 1);
154 bool is_3d = (
dim == 3);
157 for (
int i = 0; i < num_refs; i++)
161 ParMesh pmesh(MPI_COMM_WORLD, mesh);
163 for (
int i = 0; i < num_parallel_refs; i++)
175 cout <<
"Number of finite element unknowns: " << size <<
"\n";
176 cout <<
"Boundary attributes: ";
177 boundary.
Print(cout, 6);
198 std::vector<double> random_positions(3 * number_of_particles);
199 std::vector<double> random_rotations(9 * number_of_particles);
210 MPI_Bcast(random_positions.data(), 3 * number_of_particles, MPI_DOUBLE, 0,
212 MPI_Bcast(random_rotations.data(), 9 * number_of_particles, MPI_DOUBLE, 0,
222 mfem::out <<
"Error: Selected topological support not valid." 229 auto topo = [&mdm, &tau](
const Vector &x)
258 const int seed = (random_seed) ? 0 : std::numeric_limits<int>::max();
263 if (compute_boundary_integrals)
void ComputeBoundaryError(const ParGridFunction &solution)
Virtual class to define the interface for defining the material topology.
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.
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 PrintInfo(std::ostream &os=mfem::out) const
Print the information specifying the boundary conditions.
void GenerateRandomField(ParGridFunction &x)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
Class that implements the particle topology.
virtual double ComputeMetric(const Vector &x)=0
Compute the metric rho describing the material topology.
void transformation(const Vector &p, Vector &v)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetupRandomFieldGenerator(int seed=0)
void Print(std::ostream &out=mfem::out, int width=4) const
Prints array to stream with width elements per row.
void FillWithRandomRotations(std::vector< double > &x)
HYPRE_BigInt GlobalTrueVSize() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
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...
void FillWithRandomNumbers(std::vector< double > &x, double a, double b)
Fills the vector x with random numbers between a and b.
void Clear()
Clear the contents of the Mesh.
A general function coefficient.
Arbitrary order H1-conforming (continuous) finite elements.
double u(const Vector &xvec)
Class for parallel grid function.
void VerifyDefinedBoundaries(const Mesh &mesh) const
Class for parallel meshes.
int main(int argc, char *argv[])