-
Notifications
You must be signed in to change notification settings - Fork 53
Update deal.II context with fe capabilities in FEValues fashion #996
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
base: main
Are you sure you want to change the base?
Update deal.II context with fe capabilities in FEValues fashion #996
Conversation
|
@marksidoro Awesome, I will review this ASAP! In the meantime, could you clean up the commits a little? In the current form, they do not really help in reviewing, since they repeatedly change the same file. Also, could you split out the one commit that changes something in |
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.
I had a high-level view over the code. This code is quite high quality, great job! The docs and tests are nice 👍
I will do a detailed review tomorrow and we can also discuss a few things in person.
One thing you can already do is to activate the development environment by calling utilities/set_updev_env.sh. I can see that the pre-commit hooks are not run on this state.
Thats a good idea. I moved it into its own PR #997 |
0e36477 to
e14e775
Compare
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.
First batch of comments (I reviewed from CLion, but it is lacking some features for code suggestions, so I will switch to GH now ;)
| const std::span<const int>& reindex_scalar, std::vector<int>& reindexing); | ||
| } // namespace Internal | ||
|
|
||
| namespace FourCToDeal |
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.
Maybe the two namespaces are a bit much. How about just FourCToDealii and remove ConversionTools?
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.
I know I am repeating myself, but anyway: this code is so nice! It was a real pleasure to review, and I think the PR is in very good shape already.
| return dealii::MappingFEField<dim, spacedim, VectorType>( | ||
| iso_dof_handler, position_vector, mask); |
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.
After reading through the code and the docs of MappingFEField, I am beginning to understand this. The iso_dof_handler is required, since you need to have a DoFHandler with dofs in all space dimensions, and this is not guaranteed for whichever DoFHandler we use for evaluation? So you create it here and create the according position vector. Idk, but maybe my thought process helps you in documenting this a bit clearer (or you can tell me where my assumptions are wrong).
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.
You are basically correct and I have now added some docs to the mapping class to explain its usage.
ba63f5a to
3d4649c
Compare
3d4649c to
ea52227
Compare
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.
I have a few minor comments. Your added code is very readable! 👍
| /** | ||
| * reinidexings of the shape functions from 4C to deal.II for different cell types. | ||
| */ | ||
| namespace FourCToDeal |
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.
| namespace FourCToDeal | |
| namespace FourCToDealii |
|
|
||
| } // namespace FourCToDeal | ||
|
|
||
| namespace DealToFourC |
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.
| namespace DealToFourC | |
| namespace DealiiToFourC |
| "FE_NAME<dim>(degree) within the '< >' brackets. If thats not the case use the " | ||
| "templated version of this function, where you can specify the dimension explicitly.", | ||
| finite_element_name); | ||
| return Core::FE::CellType::dis_none; |
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.
| return Core::FE::CellType::dis_none; |
| FOUR_C_THROW( | ||
| "The finite element name {} must contain a dimension (dim) in the form of " | ||
| "FE_NAME<dim>(degree) within the '< >' brackets. If thats not the case use the " | ||
| "templated version of this function, where you can specify the dimension explicitly.", | ||
| finite_element_name); |
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.
Why a runtime error and not a compile time error? Are there elements that we don't support?
| FOUR_C_THROW("Unsupported finite element type '{}' for dim = {} and spacedim = {}.", | ||
| finite_element_name, 1, 1); | ||
| return Core::FE::CellType::dis_none; |
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.
I think you don't need this here (you have it at the bottom already)
| } | ||
| FOUR_C_THROW("Unsupported finite element type '{}' for dim = {} and spacedim = {}.", | ||
| finite_element_name, dim, spacedim); | ||
| return Core::FE::CellType::dis_none; |
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.
No need to return something if you throw
| const Context<dim, spacedim>& context) | ||
| { | ||
| FOUR_C_ASSERT(context.n_finite_elements() == 1, | ||
| "Currently only supported for the case that there is only one finite element in the " |
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.
| "Currently only supported for the case that there is only one finite element in the " | |
| "Currently only supported for the case that there is only one finite element type in the " |
Is it one finite element or one finite element type?
|
@marksidoro Can you address the few comments, so we can proceed here? |
@sebproell
In the code below, the DealiiWrappers namespace is extended by functionality so that a finite element discretization can be set up using the dealii::FEValues objects. The code allows for assembling global FE matrices in a typical deal.II fashion while keeping the DOF layout compatible with 4C. The goal is to be able to assemble coupling blocks between 4C and deal.II based discretizations.
The main classes added are FEValuesContext (and FEFaceValuesContext), which are wrappers around an FEValues object, together with some functionality that handles the reindexing of the local shape functions so that the underlying finite element objects are compatible with the internal ones from 4C.
For this, currently already available parts of the namespace have been reworked, namely the Context class has been updated to provide some further utility, akin to what a dealii::DofHandler would provide. I have also updated the structure/namespaces in the element_conversion.hpp.
A helper class to handle the required deal.II mapping is implemented together with a function to set it up with an isogeometric mapping (currently only working for a single cell_type in the Discretization).
Besides that, there are some further quality of life functions, as well as tests computing an L2-projection, from a simple deal.II Vector directly onto a vector in 4C layout. The problem is solved using a deal.II solver interface and using deal.II matrices and vectors.
Next steps/limitations