-
Notifications
You must be signed in to change notification settings - Fork 193
Petsc 64 bit int fixes #5252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leo-collins
wants to merge
8
commits into
leo/64bit-int
Choose a base branch
from
leo/petsc-int-fixes
base: leo/64bit-int
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Petsc 64 bit int fixes #5252
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
501b3e4
function struct use PetscInt
leo-collins 0b494ea
use correct petsc types
leo-collins 433dae1
fix header
leo-collins da13cdf
fix to legacy .at
leo-collins 14f85c5
use PetscInt
leo-collins cd6b2b3
use correct mpi type for permutation
leo-collins 61e5f65
use blas int
leo-collins ab08f70
use dtype
leo-collins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,19 +4,19 @@ | |
| #include <float.h> | ||
| #include <evaluate.h> | ||
|
|
||
| int locate_cell(struct Function *f, | ||
| PetscInt locate_cell(struct Function *f, | ||
| double *x, | ||
| int dim, | ||
| ref_cell_l1_dist try_candidate, | ||
| ref_cell_l1_dist_xtr try_candidate_xtr, | ||
| void *temp_ref_coords, | ||
| void *found_ref_coords, | ||
| double *found_ref_cell_dist_l1, | ||
| size_t ncells_ignore, | ||
| int* cells_ignore) | ||
| PetscReal *found_ref_cell_dist_l1, | ||
| PetscInt ncells_ignore, | ||
| PetscInt* cells_ignore) | ||
| { | ||
| RTError err; | ||
| int cell = -1; | ||
| PetscInt cell = -1; | ||
| int cell_ignore_found = 0; | ||
| /* NOTE: temp_ref_coords and found_ref_coords are actually of type | ||
| struct ReferenceCoords but can't be declared as such in the function | ||
|
|
@@ -25,8 +25,8 @@ int locate_cell(struct Function *f, | |
| surrounds this is declared in pointquery_utils.py. We cast when we use the | ||
| ref_coords_copy function and trust that the underlying memory which the | ||
| pointers refer to is updated as necessary. */ | ||
| double ref_cell_dist_l1 = DBL_MAX; | ||
| double current_ref_cell_dist_l1 = -0.5; | ||
| PetscReal ref_cell_dist_l1 = PETSC_MAX_REAL; | ||
| PetscReal current_ref_cell_dist_l1 = -0.5; | ||
| /* NOTE: `tolerance`, which is used throughout this funciton, is a static | ||
| variable defined outside this function when putting together all the C | ||
| code that needs to be compiled - see pointquery_utils.py */ | ||
|
|
@@ -45,7 +45,7 @@ int locate_cell(struct Function *f, | |
| if (f->extruded == 0) { | ||
| for (uint64_t i = 0; i < nids; i++) { | ||
| current_ref_cell_dist_l1 = (*try_candidate)(temp_ref_coords, f, ids[i], x); | ||
| for (uint64_t j = 0; j < ncells_ignore; j++) { | ||
| for (PetscInt j = 0; j < ncells_ignore; j++) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here about int range |
||
| if (ids[i] == cells_ignore[j]) { | ||
| cell_ignore_found = 1; | ||
| break; | ||
|
|
@@ -76,11 +76,11 @@ int locate_cell(struct Function *f, | |
| } | ||
| else { | ||
| for (uint64_t i = 0; i < nids; i++) { | ||
| int nlayers = f->n_layers; | ||
| int c = ids[i] / nlayers; | ||
| int l = ids[i] % nlayers; | ||
| PetscInt nlayers = f->n_layers; | ||
| PetscInt c = ids[i] / nlayers; | ||
| PetscInt l = ids[i] % nlayers; | ||
| current_ref_cell_dist_l1 = (*try_candidate_xtr)(temp_ref_coords, f, c, l, x); | ||
| for (uint64_t j = 0; j < ncells_ignore; j++) { | ||
| for (PetscInt j = 0; j < ncells_ignore; j++) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here |
||
| if (ids[i] == cells_ignore[j]) { | ||
| cell_ignore_found = 1; | ||
| break; | ||
|
|
@@ -112,9 +112,9 @@ int locate_cell(struct Function *f, | |
| free(ids); | ||
| } else { | ||
| if (f->extruded == 0) { | ||
| for (int c = 0; c < f->n_cols; c++) { | ||
| for (PetscInt c = 0; c < f->n_cols; c++) { | ||
| current_ref_cell_dist_l1 = (*try_candidate)(temp_ref_coords, f, c, x); | ||
| for (uint64_t j = 0; j < ncells_ignore; j++) { | ||
| for (PetscInt j = 0; j < ncells_ignore; j++) { | ||
| if (c == cells_ignore[j]) { | ||
| cell_ignore_found = 1; | ||
| break; | ||
|
|
@@ -144,10 +144,10 @@ int locate_cell(struct Function *f, | |
| } | ||
| } | ||
| else { | ||
| for (int c = 0; c < f->n_cols; c++) { | ||
| for (int l = 0; l < f->n_layers; l++) { | ||
| for (PetscInt c = 0; c < f->n_cols; c++) { | ||
| for (PetscInt l = 0; l < f->n_layers; l++) { | ||
| current_ref_cell_dist_l1 = (*try_candidate_xtr)(temp_ref_coords, f, c, l, x); | ||
| for (uint64_t j = 0; j < ncells_ignore; j++) { | ||
| for (PetscInt j = 0; j < ncells_ignore; j++) { | ||
| if (l == cells_ignore[j]) { | ||
| cell_ignore_found = 1; | ||
| break; | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this always going to be large enough? Size_t is unsigned and comes with guarantees that int doesn't