-
Notifications
You must be signed in to change notification settings - Fork 64
Examples specifications
solin edited this page May 6, 2011
·
5 revisions
(1) Mesh file:
Default name for a mesh file is "domain.mesh". Mesh file has
string markers for both element and boundary markers. If just
one material is present, use "Mat", if just one boundary then
use "Bdy". If multiple boundary markers are present, use
a geometric description ("Top", "Bottom", "Long", "Short", ...)
rather than associating them with boundary condition types
or boundary data (i.e., do not use "Dirichlet", "Neumann",
"Zero", ...).
(2) Definitions file:
All classes such as custom essential boundary conditions,
right-hand side and exact solution are in one file
called "definitions.cpp" with a header "definitions.h".
(3) Includes:
"main.cpp" only includes "definitions.h" at the beginning
"definitions.cpp" only includes "definitions.h"
"definitions.h" includes "hermes2d.h" plus more headers if
needed, but keep these at an absolute minimum.
(4) Example description:
After the include comes a narrative description of the example's
purpose in a format that is consistent with existing examples.
In particular, it contains the PDE that is solved, boundary
conditions, geometry.
(5) Parameters:
After example description come global parameters that shoud be
defined as const. All should be commented.
(6) Structure of main.cpp:
Begin with instantiating Hermes2D (a class with global functions).
Read mesh.
Perform initial mesh refinements (if applicable).
Initialize the weak formulation.
Initialize essential boundary conditions.
Create space(s).
Initialize DiscreteProblem.
Set up matrix solver, matrix, and rhs vector.
Solve the problem.
Visualize the solution.
Call View::wait();
Clean up: All objects allocated using "new" must be deleted.
(7) Comments:
Comments begin with a capital letter and end with a period ".".
Examples of correct comments:
"// Visualize the solution."
"// Clean up."
Examples of bad comments:
"// Visualize the solution"
"// visualize the solution."
"// visualize the solution"
Be careful about the quality of English in comments.