Repository navigation
Simplified fields - #180
Conversation
We use Kokkos MDSpan for everything now.
This refactor was made in preparation for updates that will use Rank2 arrays as well for consistency.
|
I'm working through some issues with this pull request. Progress can be found here: https://github.com/jacobmerson/pcms/tree/simplified-field-cleanup |
|
|
||
| auto coords = mesh_.coords(); | ||
|
|
||
| size_t offset = 0; |
There was a problem hiding this comment.
We should somehow be getting this information from MeshFIelds.
| auto channel = | ||
| rdv.CreateAdiosChannel("field2_chan1", params, redev::TransportType::BP4); | ||
|
|
||
| auto layout = pcms::OmegaHFieldLayout(mesh, layout_arr, 1); |
There was a problem hiding this comment.
I think the way we handle the field definition and layout is close, but not quite right. I expect we want a factory function that will create the field layout where the user would request for example a certain order field, or an integration point based field.
Some basic pseudo code with current thoughts, but we will probably want to iterate on this.
auto layout = CreateLagrangeLayout(mesh, order, num_components, coordinate_system);
auto layout2 = CreateLagrangeIntegrationPointLayout(mesh, order, num_components, coordinate_system);
auto layout3 = CreatePointCloudLayout(coordinates);
auto data = View(layout.GetNumOwnedDOFHolders());
// factory function can determine the appropriate field type based on the layout
auto field = CreateField(data, layout);
auto field2 = CreateField(layout2);
// helper to set field with a function.
field2.SetDofHolders([&](coords){foo(coords);}
auto data3 = View(layout3.GetNumOwnedDOFHolders());
auto field3 = CreateField(layout3);
field3.SetDofHolders(data3);Note that the fields adapter no longer needs a name. The reason that OmegaHFieldAdapter had a name is because it used that to access the backend tag storage.
- Handle dof holder data using Rank1View - Make CreateField a method of FieldLayout
|
@joyal-mathew Can you resolve the conflicts? |
|
Yes, I'll resolve these conflicts today. |
|
Thanks! @Sichao25 added modules on the SCOREC systems for |
|
It seems like there are some false positives from clang-tidy. It complains about these two cases being the same (
switch (mesh_.dim()) {
case 1:
mesh_field_ = std::make_unique<MeshFieldBackendImpl<1, 1>>(mesh_);
break;
case 2:
mesh_field_ = std::make_unique<MeshFieldBackendImpl<2, 1>>(mesh_);
break;
}I think it may be getting confused by the template. |
Sichao25
left a comment
There was a problem hiding this comment.
Added a few minor questions and suggestions for consideration.
| Omega_h::Mesh& mesh_; | ||
| std::unique_ptr<MeshFieldBackend> mesh_field_; | ||
| GridPointSearch search_; | ||
| Kokkos::View<Real*> dof_holder_data_; |
There was a problem hiding this comment.
I noticed that some Views are explicitly specified with HostMemorySpace while others are not. Looks like some features are intended to run on CPU only. Would it be helpful to ensure consistent memory space annotations?
| owned_("", coords.extent(0)), | ||
| gids_("", coords.extent(0)) | ||
| { | ||
| compoents_ = 1; |
There was a problem hiding this comment.
Is "compoents" intentional, or a typo?
| GlobalIDView<HostMemorySpace> received_gids( | ||
| received_msg.data_handle() + offset + 5, length); | ||
|
|
||
| PCMS_ALWAYS_ASSERT(offset + 5 + length - 1 < received_msg.size()); |
There was a problem hiding this comment.
The value 5 appears multiple times throughout the code. Would it be helpful to extract this into a named constant?
| CoordinateView<HostMemorySpace> coordinate_view) const override; | ||
|
|
||
| void Evaluate(LocalizationHint location, | ||
| FieldDataView<double, HostMemorySpace> results) const override; |
There was a problem hiding this comment.
Would Real be preferred over double?
| ts::ClassificationPartition cp; | ||
| std::map<redev::ClassPtn::ModelEnt, int> ent_to_rank; | ||
|
|
||
| for (int e = 0; e <= 0; ++e) { |
There was a problem hiding this comment.
Does this mean that this block will only trigger once. If so,could this be simplified?
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new simplified field interface for PCMS, providing a more streamlined API for field operations and data management. The changes include new field abstractions, layout classes, and communication utilities to improve the handling of field data across different computational meshes.
- Introduces new field interface classes (
FieldT,FieldLayout,FieldDataView) with simplified APIs - Adds communication support for fields with layout-aware serialization/deserialization
- Implements concrete field types for Omega_h meshes and point clouds with evaluation capabilities
Reviewed Changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/test_spline_interpolator.cpp | Updates Kokkos extents syntax for consistency |
| test/test_field_*.cpp | New test files for field evaluation, interpolation, copying, and communication |
| test/CMakeLists.txt | Adds test configurations for new field functionality |
| src/pcms/field.h | Core field interface definitions and data view classes |
| src/pcms/field_layout.h | Abstract field layout interface for DOF management |
| src/pcms/transfer_field2.h | Field transfer operations (copy and interpolate) |
| src/pcms/create_field.cpp | Factory functions for creating Lagrange field layouts |
| src/pcms/coordinate_system.h | Coordinate system abstractions and transformations |
| src/pcms/adapter/omega_h/ | Omega_h-specific field implementations |
| src/pcms/adapter/point_cloud/ | Point cloud field implementations |
| src/pcms/field_communicator.h | Communication utilities for distributed field operations |
Comments suppressed due to low confidence (2)
src/pcms/interpolator/adj_search.hpp:1
- Removed unused variable
nvertices_sourcewhich improves code clarity by eliminating dead code.
#ifndef ADJ_SEARCH_HPP
src/pcms/interpolator/adj_search.hpp:1
- Removed unused variable
nvertices_sourcewhich improves code clarity by eliminating dead code.
#ifndef ADJ_SEARCH_HPP
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| private: | ||
| int dim_; | ||
| int compoents_; |
There was a problem hiding this comment.
Corrected spelling of 'compoents_' to 'components_'.
| int compoents_; | |
| int components_; |
|
@joyal-mathew it looks like github actions is using the actions from this pull request. If you merge develop and push the updated CI from #206 should hopefully resolve the build issues. |
|
It looks like the integration of MeshFields in the cmake workflow is still not quite right. One good thing is that it looks like the workflow can be updated in this PR and doesn't need to be merged through from main. |
|
Yea, I'll get that fixed on this branch. |
|
0001-update-meshfields-workflow.patch @joyal-mathew Can you give this patch a try? |
|
Looks like some minor clang-tidy issues, but the build/tests are back to passing. |
This PR introduces the new simplified field interface.