@@ -42,36 +42,92 @@ void CDriverBase::SetContainers_Null() {
4242 * down a hierarchy over all zones, multi-grid levels, equation sets, and equation terms as described in the comments
4343 * below. ---*/
4444
45- config_container = nullptr ;
46- output_container = nullptr ;
47- geometry_container = nullptr ;
48- solver_container = nullptr ;
49- numerics_container = nullptr ;
50-
51- surface_movement = nullptr ;
52- grid_movement = nullptr ;
53- FFDBox = nullptr ;
54-
5545 config_container = new CConfig*[nZone]();
5646 output_container = new COutput*[nZone]();
5747 geometry_container = new CGeometry***[nZone]();
5848 solver_container = new CSolver****[nZone]();
5949 numerics_container = new CNumerics*****[nZone]();
6050 surface_movement = new CSurfaceMovement*[nZone]();
6151 grid_movement = new CVolumetricMovement**[nZone]();
62- FFDBox = new CFreeFormDefBox**[nZone]();
6352
6453 nInst = new unsigned short [nZone];
6554
6655 for (iZone = 0 ; iZone < nZone; iZone++) {
6756 nInst[iZone] = 1 ;
6857 }
58+ }
59+
60+ void CDriverBase::CommonPostprocessing () {
61+
62+ if (numerics_container != nullptr ) {
63+ for (iZone = 0 ; iZone < nZone; iZone++) {
64+ delete[] numerics_container[iZone];
65+ }
66+ delete[] numerics_container;
67+ }
68+ if (rank == MASTER_NODE) cout << " Deleted CNumerics container." << endl;
69+
70+ if (solver_container != nullptr ) {
71+ for (iZone = 0 ; iZone < nZone; iZone++) {
72+ delete[] solver_container[iZone];
73+ }
74+ delete[] solver_container;
75+ }
76+ if (rank == MASTER_NODE) cout << " Deleted CSolver container." << endl;
77+
78+ if (geometry_container != nullptr ) {
79+ for (iZone = 0 ; iZone < nZone; iZone++) {
80+ if (geometry_container[iZone] != nullptr ) {
81+ for (iInst = 0 ; iInst < nInst[iZone]; iInst++) {
82+ delete geometry_container[iZone][iInst][MESH_0];
83+ delete[] geometry_container[iZone][iInst];
84+ }
85+ delete[] geometry_container[iZone];
86+ }
87+ }
88+ delete[] geometry_container;
89+ }
90+ if (rank == MASTER_NODE) cout << " Deleted CGeometry container." << endl;
91+
92+ if (surface_movement != nullptr ) {
93+ for (iZone = 0 ; iZone < nZone; iZone++) {
94+ delete surface_movement[iZone];
95+ }
96+ delete[] surface_movement;
97+ }
98+ if (rank == MASTER_NODE) cout << " Deleted CSurfaceMovement class." << endl;
99+
100+ if (grid_movement != nullptr ) {
101+ for (iZone = 0 ; iZone < nZone; iZone++) {
102+ if (grid_movement[iZone] != nullptr ) {
103+ for (iInst = 0 ; iInst < nInst[iZone]; iInst++) {
104+ delete grid_movement[iZone][iInst];
105+ }
106+ delete[] grid_movement[iZone];
107+ }
108+ }
109+ delete[] grid_movement;
110+ }
111+ if (rank == MASTER_NODE) cout << " Deleted CVolumetricMovement class." << endl;
69112
70- driver_config = nullptr ;
71- driver_output = nullptr ;
113+ if (config_container != nullptr ) {
114+ for (iZone = 0 ; iZone < nZone; iZone++) {
115+ delete config_container[iZone];
116+ }
117+ delete[] config_container;
118+ }
119+ delete driver_config;
120+ if (rank == MASTER_NODE) cout << " Deleted CConfig container." << endl;
121+
122+ if (output_container != nullptr ) {
123+ for (iZone = 0 ; iZone < nZone; iZone++) {
124+ delete output_container[iZone];
125+ }
126+ delete[] output_container;
127+ }
128+ if (rank == MASTER_NODE) cout << " Deleted COutput class." << endl;
72129
73- main_config = nullptr ;
74- main_geometry = nullptr ;
130+ delete[] nInst;
75131}
76132
77133unsigned short CDriverBase::GetNumberDesignVariables () const { return main_config->GetnDV (); }
0 commit comments