Use meshFields parametric coordinates for dof coordinate construction - #368
Use meshFields parametric coordinates for dof coordinate construction#368Sichao25 wants to merge 2 commits into
Conversation
| : dof_holder_coords_(dof_holder_coords), coords_(coords), offset_(offset) | ||
| { | ||
| // Maps a meshFields topology to the dimension. | ||
| KOKKOS_INLINE_FUNCTION int TopologyToDim(MeshField::Mesh_Topology topo) |
There was a problem hiding this comment.
Can you use meshEntDim which is defined in all the shapes?
There was a problem hiding this comment.
I feel like the mapping here is for the DOFs, while the shape function entity dimensions are for the element itself. If my understanding is correct, then they should be different mapping.
| dof_holder_coords_(offset_ + i, 1) = coords_[2 * i + 1]; | ||
| // Gets the appropriate MeshField element | ||
| template <int Dim, int Order> | ||
| auto GetMeshFieldElement(Omega_h::Mesh& mesh) |
There was a problem hiding this comment.
I suspect you want these sort of helpers to take dim/oder as a runtime argument. That will let you have a limited number of places in the source code where you have to deal with the static to dynamic mapping.
| } | ||
|
|
||
| offset += mesh.nents(i); | ||
| if (mesh_.dim() == 2 && order == 1) |
There was a problem hiding this comment.
If you make the helper functions deal with the dynamic mapping then the code here will be significantly cleaner.
There was a problem hiding this comment.
With the requirement from the MeshFields API, we inevitably need to handle the static to dynamic mapping somewhere. I just moved the dispatch here into a helper function. Does this align with what you had in mind?
As mentioned in the #346 , the hardcoded coordinate construction in meshFields layout based on whether a DOF belongs to a vertex or edge can be replaced by using the parametric coordinates provided by meshFields (The DOF coordinates are computed as the sum of the vertex coordinates weighted by the corresponding parametric coordinates.)
A test has been added to verify that the resulting coordinates are correct.