forked from enzo-project/enzo-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--HG-- branch : week-of-code
- Loading branch information
John Wise
committed
Nov 13, 2009
1 parent
3a8ca18
commit b5a6e67
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/*********************************************************************** | ||
/ | ||
/ EXTERNAL BOUNDARY CLASS (DELETES OBSOLETE EXTERNAL BOUNDARY VALUES) | ||
/ | ||
/ written by: John Wise | ||
/ date: November, 2009 | ||
/ modified1: | ||
/ | ||
/ PURPOSE: | ||
/ | ||
************************************************************************/ | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include "ErrorExceptions.h" | ||
#include "macros_and_parameters.h" | ||
#include "typedefs.h" | ||
#include "global_data.h" | ||
#include "Fluxes.h" | ||
#include "GridList.h" | ||
#include "ExternalBoundary.h" | ||
#include "Grid.h" | ||
|
||
// This routine reads the external boundary from the provided file pointer | ||
// | ||
|
||
/* function prototypes */ | ||
|
||
int ExternalBoundary::DeleteObsoleteFields(int *ObsoleteFields, | ||
int NumberOfObsoleteFields) | ||
{ | ||
|
||
int i, j, k, dim, field; | ||
int NumberOfDeletions = 0; | ||
|
||
for (field = 0; field < NumberOfObsoleteFields; field++) | ||
for (i = 0; i < NumberOfBaryonFields; i++) | ||
if (BoundaryFieldType[i] == ObsoleteFields[field]) { | ||
|
||
/* Delete values and shift BoundaryFieldType and BoundaryType | ||
back */ | ||
|
||
for (j = i; j < MAX_NUMBER_OF_BARYON_FIELDS-1; j++) | ||
BoundaryFieldType[j] = BoundaryFieldType[j+1]; | ||
BoundaryFieldType[MAX_NUMBER_OF_BARYON_FIELDS-1] = FieldUndefined; | ||
|
||
for (dim = 0; dim < BoundaryRank; dim++) | ||
if (BoundaryDimension[dim] > 1) { | ||
for (j = 0; j < 2; j++) { | ||
|
||
delete [] BoundaryType[i][dim][j]; | ||
for (k = i; k < MAX_NUMBER_OF_BARYON_FIELDS-1; k++) | ||
BoundaryType[k][dim][j] = BoundaryType[k+1][dim][j]; | ||
BoundaryType[MAX_NUMBER_OF_BARYON_FIELDS-1][dim][j] = NULL; | ||
|
||
} // ENDFOR direction (face) | ||
} // ENDIF dimension > 1 | ||
|
||
NumberOfDeletions++; | ||
|
||
break; | ||
|
||
} // ENDIF matching field | ||
|
||
NumberOfBaryonFields -= NumberOfDeletions; | ||
|
||
return SUCCESS; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/*********************************************************************** | ||
/ | ||
/ GRID CLASS (DELETE OBSOLETE FIELDS WHEN RESTARTING) | ||
/ | ||
/ written by: John Wise | ||
/ date: November, 2009 | ||
/ modified1: | ||
/ | ||
/ PURPOSE: | ||
/ | ||
************************************************************************/ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include "ErrorExceptions.h" | ||
#include "macros_and_parameters.h" | ||
#include "typedefs.h" | ||
#include "global_data.h" | ||
#include "Fluxes.h" | ||
#include "GridList.h" | ||
#include "ExternalBoundary.h" | ||
#include "Grid.h" | ||
#include "Hierarchy.h" | ||
#include "TopGridData.h" | ||
#include "LevelHierarchy.h" | ||
|
||
bool FirstTime = true; | ||
|
||
int grid::DeleteObsoleteFields(int *ObsoleteFields, | ||
int NumberOfObsoleteFields) | ||
{ | ||
|
||
int i, j, field, NumberOfDeletions = 0; | ||
|
||
for (field = 0; field < NumberOfObsoleteFields; field++) | ||
for (i = 0; i < NumberOfBaryonFields; i++) | ||
if (FieldType[i] == ObsoleteFields[field]) { | ||
|
||
if (debug && FirstTime) | ||
printf("Deleting unused field %d (FieldType = %d = %s)\n", | ||
i, ObsoleteFields[field], DataLabel[i]); | ||
|
||
/* Delete field */ | ||
|
||
if (MyProcessorNumber == ProcessorNumber) | ||
delete [] BaryonField[i]; | ||
|
||
/* Shift FieldType and BaryonField back */ | ||
|
||
for (j = i; j < MAX_NUMBER_OF_BARYON_FIELDS-1; j++) | ||
FieldType[j] = FieldType[j+1]; | ||
FieldType[MAX_NUMBER_OF_BARYON_FIELDS-1] = FieldUndefined; | ||
|
||
if (MyProcessorNumber == ProcessorNumber) { | ||
for (j = i; j < MAX_NUMBER_OF_BARYON_FIELDS-1; j++) | ||
BaryonField[j] = BaryonField[j+1]; | ||
BaryonField[MAX_NUMBER_OF_BARYON_FIELDS-1] = NULL; | ||
} | ||
|
||
if (FirstTime) { | ||
for (j = i; j < MAX_NUMBER_OF_BARYON_FIELDS-1; j++) | ||
DataLabel[j] = DataLabel[j+1]; | ||
DataLabel[MAX_NUMBER_OF_BARYON_FIELDS-1] = NULL; | ||
} | ||
|
||
NumberOfDeletions++; | ||
break; | ||
|
||
} // ENDIF matching field | ||
|
||
NumberOfBaryonFields -= NumberOfDeletions; | ||
FirstTime = false; | ||
|
||
return SUCCESS; | ||
|
||
} |