-
Notifications
You must be signed in to change notification settings - Fork 847
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
Clean up the partitioner for the FEM solver. #2443
Open
vdweide
wants to merge
8
commits into
develop
Choose a base branch
from
feature_hom_cleanup_partitioning
base: develop
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
+1,712
−1,357
Conversation
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
…ons to improve readability
Comment on lines
+148
to
+232
switch (nCornerPoints) { | ||
case 2: { | ||
/* Element is a line. Check if the node numbering must be swapped. If so | ||
also the element information must be swapped, because element 0 is to | ||
the left of the face and element 1 to the right. */ | ||
if (cornerPoints[1] < cornerPoints[0]) { | ||
swap(cornerPoints[0], cornerPoints[1]); | ||
swapElements = true; | ||
} | ||
break; | ||
} | ||
|
||
case 3: { | ||
/* Element is a triangle. The vertices are sorted in increasing order. | ||
If the sequence of the new numbering is opposite to the current | ||
numbering, the element information must be exchanged, because | ||
element 0 is to the left of the face and element 1 to the right. */ | ||
unsigned long nn[] = {cornerPoints[0], cornerPoints[1], cornerPoints[2]}; | ||
unsigned short ind = 0; | ||
if (nn[1] < nn[ind]) ind = 1; | ||
if (nn[2] < nn[ind]) ind = 2; | ||
|
||
unsigned short indm1 = ind == 0 ? 2 : ind - 1; // Next lower index. | ||
unsigned short indp1 = ind == 2 ? 0 : ind + 1; // Next upper index. | ||
|
||
if (nn[indp1] < nn[indm1]) { | ||
/* The orientation of the triangle remains the same. | ||
Store the new sorted node numbering. */ | ||
cornerPoints[0] = nn[ind]; | ||
cornerPoints[1] = nn[indp1]; | ||
cornerPoints[2] = nn[indm1]; | ||
} else { | ||
/* The orientation of the triangle changes. Store the new | ||
sorted node numbering and set swapElements to true. */ | ||
cornerPoints[0] = nn[ind]; | ||
cornerPoints[1] = nn[indm1]; | ||
cornerPoints[2] = nn[indp1]; | ||
swapElements = true; | ||
} | ||
|
||
break; | ||
} | ||
|
||
case 4: { | ||
/* Element is a quadrilateral. The vertices are sorted in increasing order | ||
under the condition neighboring vertices remain neighbors. If the | ||
sequence of the new numbering is opposite to the current | ||
numbering, the element information must be exchanged, because | ||
element 0 is to the left of the face and element 1 to the right. */ | ||
unsigned long nn[] = {cornerPoints[0], cornerPoints[1], cornerPoints[2], cornerPoints[3]}; | ||
unsigned short ind = 0; | ||
if (nn[1] < nn[ind]) ind = 1; | ||
if (nn[2] < nn[ind]) ind = 2; | ||
if (nn[3] < nn[ind]) ind = 3; | ||
|
||
unsigned short indm1 = ind == 0 ? 3 : ind - 1; // Next lower index. | ||
unsigned short indp1 = ind == 3 ? 0 : ind + 1; // Next upper index. | ||
unsigned short indp2 = ind >= 2 ? ind - 2 : ind + 2; // Opposite index. | ||
|
||
if (nn[indp1] < nn[indm1]) { | ||
/* The orientation of the quadrilateral remains the same. | ||
Store the new sorted node numbering. */ | ||
cornerPoints[0] = nn[ind]; | ||
cornerPoints[1] = nn[indp1]; | ||
cornerPoints[2] = nn[indp2]; | ||
cornerPoints[3] = nn[indm1]; | ||
} else { | ||
/* The orientation of the quadrilateral changes. Store the new | ||
sorted node numbering and set swapElements to true. */ | ||
cornerPoints[0] = nn[ind]; | ||
cornerPoints[1] = nn[indm1]; | ||
cornerPoints[2] = nn[indp2]; | ||
cornerPoints[3] = nn[indp1]; | ||
swapElements = true; | ||
} | ||
|
||
break; | ||
} | ||
|
||
default: { | ||
ostringstream message; | ||
message << "Unknown surface element type with " << nCornerPoints << " corners." << endl; | ||
SU2_MPI::Error(message.str(), CURRENT_FUNCTION); | ||
} | ||
} |
Check notice
Code scanning / CodeQL
Long switch case Note
Switch has at least one case that is too long: .
4 (35 lines)
Error loading related location
Loading
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
Split the partitioning of the FEM solver into smaller (and thus more readable) functions. The actual partitioning function CPhysicalGeometry::SetColorFEMGrid_Parallel now only calls other functions to carry out those sub-tasks. Furthermore, some explicit iterators have been replaced by auto and some fem toolbox classes have been introduced.
The libxsmm library has been removed as an option for the BLAS functionality. This library is outdated and is not used anymore. Instead OpenBLAS, MKL or whatever optimized BLAS implementation should be used.
Related Work
This is the second of a couple of PRs to clean up the code for the DG-FEM solver. It does not add any functionality nor it fixes any bugs.
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.
pre-commit run --all
to format old commits.