* For each run, the input filename must be given on the command line. In all * * cases, the command line is: * * * * executable * *
| 49 | * * |
| 50 | *******************************************************************************/ |
| 51 | int |
| 52 | main(int argc, char* argv[]) |
| 53 | { |
| 54 | // Initialize IBAMR and libraries. Deinitialization is handled by this object as well. |
| 55 | IBTKInit ibtk_init(argc, argv, MPI_COMM_WORLD); |
| 56 | |
| 57 | { // cleanup dynamically allocated objects prior to shutdown |
| 58 | |
| 59 | // Parse command line options, set some standard options from the input |
| 60 | // file, and enable file logging. |
| 61 | Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "ghost_cells.log"); |
| 62 | Pointer<Database> input_db = app_initializer->getInputDatabase(); |
| 63 | |
| 64 | // Create major algorithm and data objects that comprise the |
| 65 | // application. These objects are configured from the input database. |
| 66 | Pointer<CartesianGridGeometry<NDIM>> grid_geometry = new CartesianGridGeometry<NDIM>( |
| 67 | "CartesianGeometry", app_initializer->getComponentDatabase("CartesianGeometry")); |
| 68 | Pointer<PatchHierarchy<NDIM>> patch_hierarchy = new PatchHierarchy<NDIM>("PatchHierarchy", grid_geometry); |
| 69 | Pointer<StandardTagAndInitialize<NDIM>> error_detector = new StandardTagAndInitialize<NDIM>( |
| 70 | "StandardTagAndInitialize", nullptr, app_initializer->getComponentDatabase("StandardTagAndInitialize")); |
| 71 | Pointer<BergerRigoutsos<NDIM>> box_generator = new BergerRigoutsos<NDIM>(); |
| 72 | Pointer<LoadBalancer<NDIM>> load_balancer = |
| 73 | new LoadBalancer<NDIM>("LoadBalancer", app_initializer->getComponentDatabase("LoadBalancer")); |
| 74 | Pointer<GriddingAlgorithm<NDIM>> gridding_algorithm = |
| 75 | new GriddingAlgorithm<NDIM>("GriddingAlgorithm", |
| 76 | app_initializer->getComponentDatabase("GriddingAlgorithm"), |
| 77 | error_detector, |
| 78 | box_generator, |
| 79 | load_balancer); |
| 80 | |
| 81 | // Initialize the AMR patch hierarchy. |
| 82 | gridding_algorithm->makeCoarsestLevel(patch_hierarchy, 0.0); |
| 83 | int tag_buffer = 1; |
| 84 | int level_number = 0; |
| 85 | bool done = false; |
| 86 | while (!done && (gridding_algorithm->levelCanBeRefined(level_number))) |
| 87 | { |
| 88 | gridding_algorithm->makeFinerLevel(patch_hierarchy, 0.0, 0.0, tag_buffer); |
| 89 | done = !patch_hierarchy->finerLevelExists(level_number); |
| 90 | ++level_number; |
| 91 | } |
| 92 | |
| 93 | // Create cell-centered and node-centered quantities, and initialize them with a function read from the input |
| 94 | // file |
| 95 | Pointer<CellVariable<NDIM, double>> Q_var = new CellVariable<NDIM, double>("Q"); |
| 96 | Pointer<NodeVariable<NDIM, double>> N_var = new NodeVariable<NDIM, double>("Q Node"); |
| 97 | |
| 98 | auto var_db = VariableDatabase<NDIM>::getDatabase(); |
| 99 | // Total amount patch indices. Note we need a single ghost cell width on the cell centered quantity. |
| 100 | const int Q_tot_idx = |
| 101 | var_db->registerVariableAndContext(Q_var, var_db->getContext("Total Amount"), IntVector<NDIM>(1)); |
| 102 | const int N_1_idx = var_db->registerVariableAndContext(N_var, var_db->getContext("Method 1")); |
| 103 | const int N_2_idx = var_db->registerVariableAndContext(N_var, var_db->getContext("Method 2")); |
| 104 | // Average amount patch index. Note we need a single ghost cell width. |
| 105 | const int Q_avg_idx = |
| 106 | var_db->registerVariableAndContext(Q_var, var_db->getContext("Average Amount"), IntVector<NDIM>(1)); |
| 107 | // Output some components |
| 108 | Pointer<VisItDataWriter<NDIM>> visit_data_writer = new VisItDataWriter<NDIM>( |
nothing calls this directly
no test coverage detected