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

Function main

ibtk/examples/PhysBdryOps/example.cpp:46–273  ·  view source on GitHub ↗

* For each run, the input filename must be given on the command line. In all * * cases, the command line is: * * * * executable * *

Source from the content-addressed store, hash-verified

44 * *
45 *******************************************************************************/
46int
47main(int argc, char* argv[])
48{
49 // Initialize IBAMR and libraries. Deinitialization is handled by this object as well.
50 IBTKInit ibtk_init(argc, argv, MPI_COMM_WORLD);
51
52 { // cleanup dynamically allocated objects prior to shutdown
53
54 // Parse command line options, set some standard options from the input
55 // file, and enable file logging.
56 Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "cc_poisson.log");
57 Pointer<Database> input_db = app_initializer->getInputDatabase();
58
59 // Create major algorithm and data objects that comprise the
60 // application. These objects are configured from the input database.
61 Pointer<CartesianGridGeometry<NDIM>> grid_geometry = new CartesianGridGeometry<NDIM>(
62 "CartesianGeometry", app_initializer->getComponentDatabase("CartesianGeometry"));
63 Pointer<PatchHierarchy<NDIM>> patch_hierarchy = new PatchHierarchy<NDIM>("PatchHierarchy", grid_geometry);
64 Pointer<StandardTagAndInitialize<NDIM>> error_detector = new StandardTagAndInitialize<NDIM>(
65 "StandardTagAndInitialize", nullptr, app_initializer->getComponentDatabase("StandardTagAndInitialize"));
66 Pointer<BergerRigoutsos<NDIM>> box_generator = new BergerRigoutsos<NDIM>();
67 Pointer<LoadBalancer<NDIM>> load_balancer =
68 new LoadBalancer<NDIM>("LoadBalancer", app_initializer->getComponentDatabase("LoadBalancer"));
69 Pointer<GriddingAlgorithm<NDIM>> gridding_algorithm =
70 new GriddingAlgorithm<NDIM>("GriddingAlgorithm",
71 app_initializer->getComponentDatabase("GriddingAlgorithm"),
72 error_detector,
73 box_generator,
74 load_balancer);
75
76 // Initialize the AMR patch hierarchy.
77 gridding_algorithm->makeCoarsestLevel(patch_hierarchy, 0.0);
78 int tag_buffer = 1;
79 int level_number = 0;
80 bool done = false;
81 while (!done && (gridding_algorithm->levelCanBeRefined(level_number)))
82 {
83 gridding_algorithm->makeFinerLevel(patch_hierarchy, 0.0, 0.0, tag_buffer);
84 done = !patch_hierarchy->finerLevelExists(level_number);
85 ++level_number;
86 }
87
88 // Create cell-centered data and extrapolate that data at physical
89 // boundaries to obtain ghost cell values.
90 VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();
91 Pointer<VariableContext> context = var_db->getContext("CONTEXT");
92 Pointer<CellVariable<NDIM, double>> var = new CellVariable<NDIM, double>("v");
93 const int gcw = 4;
94 const int idx = var_db->registerVariableAndContext(var, context, gcw);
95 for (int ln = 0; ln <= patch_hierarchy->getFinestLevelNumber(); ++ln)
96 {
97 Pointer<PatchLevel<NDIM>> level = patch_hierarchy->getPatchLevel(ln);
98 level->allocatePatchData(idx);
99 for (PatchLevel<NDIM>::Iterator p(level); p; p++)
100 {
101 Pointer<Patch<NDIM>> patch = level->getPatch(p());
102 const Box<NDIM>& patch_box = patch->getBox();
103 const hier::Index<NDIM>& patch_lower = patch_box.lower();

Callers

nothing calls this directly

Calls 7

rel_equal_epsFunction · 0.85
getInputDatabaseMethod · 0.80
getComponentDatabaseMethod · 0.80
getPatchLevelMethod · 0.80
allocatePatchDataMethod · 0.80
getFinestLevelNumberMethod · 0.45

Tested by

no test coverage detected