-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Model direct access and just-in-time mapping in schema #31
Comments
Since preCICE has this information already, I don't see why we should ask the user to also specify this in the adapter config. -> do we really need to give this in the config? An API function would be great!
Of the three, I like the However, the check in the "normal case" would be:
Given this, the
|
A potential difficulty with |
To also enable a mixture of both scenarios, we should distinguish
then we would have something like std::string mesh("wormhole");
if (!accessAllowed){
participant.set_mesh_vertices(mesh, locations, vertex_ids);
} else {
if(requiresAccessRegion){
precice.set_mesh_access_region(mesh, bounding_box);
}
precice.get_mesh_vertex_ids_and_coordinates(mesh, vertex_ids, coordinates);
}
data = participant.read_data(mesh, "Read-Data", vertex_ids, dt)
participant.write_data(mesh, "Write-Data", vertex_ids, data) These would be all information we have in preCICE and can clearly forward to the user via the API. In principle, I would also vote to encode this information in the API rather than any adapter configuration file. For the ID-based reading and writing, the above approach should be sufficient in my opinion. For just-in-time mapping, however, we would need to have another API function to distinguish reading and writing via IDs vs via coordinates on top. |
I agree that option 2 above might be easier seen from the configuration. I am bit afraid, however, that the necessary API functions will get complicated. @davidscn IIUC you are suggesting 3 functions? I don't yet understand why 2 would not be enough. Could you explain your current suggestion, potential names and signatures of the functions and what they do? |
Do we still want the
I would expect the default case to not need an Or do I overlook a larger paradigm shift? |
/// Whether the API access was enabled on a received mesh or not. (don't like the name though)
bool allowsAPIAccess(std::string_view meshName);
/// Whether the API access requires defining an access region using \p setMeshAccessRegion or whether this may be omitted
/// (currently not entirely straightforward to implement, we raise an error only later in the partitioning, if it was required, i.e., our check in the ParticipantImpl is not complete at the moment as the partitioning will complain otherwise)
bool requiresAccessRegion(std::string_view meshName); These API functions are sufficient for calling the The point I was trying to make was that (if you want a fully configurable adapter), you have to use different API functions for reading and writing using just-in-time mapping as opposed to the direct access. The adapter itself doesn't know about it. The third one would then be /// Whether we can use the just-in-time mapping interface or not.
bool hasJustInTimeMapping(std::string_view meshName, std::string_view dataName); I am not sure if there are use cases for this. I could imagine that a could uses either the one or the other API for data access. |
The difficulty of bool allowsAPIAccess(std::string_view meshName); is that it should also return false on provided meshes. It would need to be The more I think about it, the less I like option 2 above. Most adapters will anyway only support one variant: either the old one ( Admittedly, all this is a bit motivated from the perspective of a user who does not treat the adapter as a black box. Maybe, we could assume this for these advanced features? |
This approach sounds intuitive to me. 👍
I am not sure I understand what you mean here. Could you please elaborate? |
There are two typical preCICE users: Those that use adapters off-the-shelve and those that develop their own (and sometimes both use cases are combined). For an adapter dev, such new API functions as discussed above could be intricate as they are a few and their combination needs careful thought. For a (black-box) adapter user, it's indeed annoying to changes things in two places (preCICE config and adapter config). But this only comes into play if an adapter really support two variants here. For example, I could imagine this for the FEniCS adapter at some point: (1) the classical provided mesh cases, (2) direct access to sample higher-order shape functions. Then to change from (1) to (2), indeed one needs to change things in two places. However, even with new API functions this is the case as one always needs to change the mesh name (from "MyMesh" to "TheirMesh"). |
There are (now) two distinct ways how to interact with meshes and data in preCICE: provide coordinates or directly access received meshes (potentially via just-in-time mapping).
We are currently discussing to rename
direct-access
toapi-access
.We also need a way to distinguish both options in adapter code.
Either:
Or:
There are different ways we could do this:
1. With an
is_received
option in the adapter config defaulting to "false":Instead of
is_received
, we could, obviously, dois_provided
.Or some enum:
mesh_locations = {received or provided}
. We uselocation
currently to distinguish between nodes/centers or surface/volume. Is there a better name?2. With a new API function:
participant.is_mesh_received("Mesh")
orparticipant.is_mesh_access_region_required("Mesh")
orparticipant.requiresCoordinates("Mesh")
The text was updated successfully, but these errors were encountered: