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

Function main

tests/IBTK/phys_boundary_ops.cpp:50–286  ·  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

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

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