MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / main

Function main

examples/fe_mechanics/ex0/example.cpp:207–563  ·  view source on GitHub ↗

* For each run, the input filename and restart information (if needed) must * * be given on the command line. For non-restarted case, command line is: * * * * executable * *

Source from the content-addressed store, hash-verified

205 * *
206 *******************************************************************************/
207int
208main(int argc, char* argv[])
209{
210 // Initialize libMesh and SAMRAI.
211 LibMeshInit init(argc, argv);
212 SAMRAI_MPI::setCommunicator(PETSC_COMM_WORLD);
213 SAMRAIManager::startup();
214
215 { // cleanup dynamically allocated objects prior to shutdown
216
217 // Parse command line options, set some standard options from the input
218 // file, initialize the restart database (if this is a restarted run),
219 // and enable file logging.
220 Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "IB.log");
221 Pointer<Database> input_db = app_initializer->getInputDatabase();
222
223 // Get various standard options set in the input file.
224 const bool dump_viz_data = app_initializer->dumpVizData();
225 const int viz_dump_interval = app_initializer->getVizDumpInterval();
226#ifdef LIBMESH_HAVE_EXODUS_API
227 const bool uses_exodus = dump_viz_data && !app_initializer->getExodusIIFilename().empty();
228#else
229 const bool uses_exodus = false;
230 if (!app_initializer->getExodusIIFilename().empty())
231 {
232 plog << "WARNING: libMesh was compiled without Exodus support, so no "
233 << "Exodus output will be written in this program.\n";
234 }
235#endif
236 const string exodus_filename = app_initializer->getExodusIIFilename();
237
238 const bool dump_restart_data = app_initializer->dumpRestartData();
239 const int restart_dump_interval = app_initializer->getRestartDumpInterval();
240 const string restart_dump_dirname = app_initializer->getRestartDumpDirectory();
241
242 const bool dump_timer_data = app_initializer->dumpTimerData();
243 const int timer_dump_interval = app_initializer->getTimerDumpInterval();
244
245 // Create a simple FE mesh.
246 Mesh mesh(init.comm(), NDIM);
247 if (input_db->keyExists("MESH_NAME"))
248 {
249 mesh.read(input_db->getString("MESH_NAME"));
250 }
251 else
252 {
253 const string elem_type = input_db->getStringWithDefault("ELEM_TYPE", "TRI3");
254 int ps_x = input_db->getDouble("N_X");
255 int ps_y = (NDIM > 1 ? input_db->getDouble("N_Y") : 0);
256 int ps_z = (NDIM > 2 ? input_db->getDouble("N_Z") : 0);
257
258 // Build grid mesh
259 MeshTools::Generation::build_cube(mesh,
260 ps_x,
261 (NDIM > 1) ? ps_y : 0,
262 (NDIM > 2) ? ps_z : 0,
263 0.0,
264 1.0,

Callers

nothing calls this directly

Calls 15

rel_equal_epsFunction · 0.85
jacobianFunction · 0.85
sumReductionFunction · 0.85
maxReductionFunction · 0.85
getInputDatabaseMethod · 0.80
dumpVizDataMethod · 0.80
getVizDumpIntervalMethod · 0.80
getExodusIIFilenameMethod · 0.80
dumpRestartDataMethod · 0.80

Tested by

no test coverage detected