* 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 * *
| 120 | * * |
| 121 | *******************************************************************************/ |
| 122 | int |
| 123 | main(int argc, char* argv[]) |
| 124 | { |
| 125 | // Initialize IBAMR and libraries. Deinitialization is handled by this object as well. |
| 126 | IBTKInit ibtk_init(argc, argv, MPI_COMM_WORLD); |
| 127 | |
| 128 | // Several parts of the code (such as LDataManager) expect mesh files, |
| 129 | // specified in the input file, to exist in the current working |
| 130 | // directory. Since tests are run in temporary directories we need to regenerate these input |
| 131 | // to work. We also create a petsc options file for CIB solvers. |
| 132 | if (IBTK_MPI::getRank() == 0) |
| 133 | { |
| 134 | std::ifstream shell_in_vertex_stream(SOURCE_DIR "/shell_3d_in.vertex"); |
| 135 | std::ofstream shell_in_cwd("shell_3d_in.vertex"); |
| 136 | shell_in_cwd << shell_in_vertex_stream.rdbuf(); |
| 137 | |
| 138 | std::ifstream shell_out_vertex_stream(SOURCE_DIR "/shell_3d_out.vertex"); |
| 139 | std::ofstream shell_out_cwd("shell_3d_out.vertex"); |
| 140 | shell_out_cwd << shell_out_vertex_stream.rdbuf(); |
| 141 | |
| 142 | std::ifstream petsc_options_stream(SOURCE_DIR "/petsc_options.dat"); |
| 143 | std::ofstream petsc_options_cwd("petsc_options.dat"); |
| 144 | petsc_options_cwd << petsc_options_stream.rdbuf(); |
| 145 | } |
| 146 | |
| 147 | { // cleanup dynamically allocated objects prior to shutdown |
| 148 | |
| 149 | // Parse command line options, set some standard options from the input |
| 150 | // file, initialize the restart database (if this is a restarted run), |
| 151 | // and enable file logging. |
| 152 | Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "CIB.log"); |
| 153 | Pointer<Database> input_db = app_initializer->getInputDatabase(); |
| 154 | |
| 155 | // some variants of this test use the SVD, some don't |
| 156 | const auto inverse_type = IBAMR::string_to_enum<IBAMR::MobilityMatrixInverseType>( |
| 157 | input_db->getStringWithDefault("mobility_inverse_type", "LAPACK_SVD")); |
| 158 | |
| 159 | // Read default Petsc options |
| 160 | if (input_db->keyExists("petsc_options_file")) |
| 161 | { |
| 162 | std::string petsc_options_file = input_db->getString("petsc_options_file"); |
| 163 | PetscOptionsInsertFile(PETSC_COMM_WORLD, nullptr, petsc_options_file.c_str(), PETSC_TRUE); |
| 164 | } |
| 165 | |
| 166 | // Get various standard options set in the input file. |
| 167 | const bool dump_viz_data = app_initializer->dumpVizData(); |
| 168 | const int viz_dump_interval = app_initializer->getVizDumpInterval(); |
| 169 | const bool uses_visit = dump_viz_data && !app_initializer->getVisItDataWriter().isNull(); |
| 170 | |
| 171 | const bool dump_restart_data = app_initializer->dumpRestartData(); |
| 172 | const int restart_dump_interval = app_initializer->getRestartDumpInterval(); |
| 173 | const string restart_dump_dirname = app_initializer->getRestartDumpDirectory(); |
| 174 | |
| 175 | const bool dump_postproc_data = app_initializer->dumpPostProcessingData(); |
| 176 | const int postproc_data_dump_interval = app_initializer->getPostProcessingDataDumpInterval(); |
| 177 | const string postproc_data_dump_dirname = app_initializer->getPostProcessingDataDumpDirectory(); |
| 178 | if (dump_postproc_data && (postproc_data_dump_interval > 0) && !postproc_data_dump_dirname.empty()) |
| 179 | { |
nothing calls this directly
no test coverage detected