-
Notifications
You must be signed in to change notification settings - Fork 1
WIP: autocxx #19
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?
WIP: autocxx #19
Conversation
The environment variable DEP_MFEM_ROOT has been renamed MFEM_DIR as this seems to be the expected name https://mfem.org/building/
Autocxx output cargo directives of the form cargo::* which require that version of Rust.
The environment variable DEP_MFEM_ROOT has been renamed MFEM_DIR as this seems to be the expected name https://mfem.org/building/
@@ -18,6 +16,6 @@ file (WRITE ${CMAKE_BINARY_DIR}/mfem_info.txt | |||
"INCLUDE_DIRS=${MFEM_INCLUDE_DIRS}\n" | |||
"LIBRARY_DIR=${MFEM_LIBRARY_DIR}\n" | |||
"CXX_FLAGS=${MFEM_CXX_FLAGS}\n" | |||
) | |||
) |
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.
nit
@@ -0,0 +1,76 @@ | |||
// Disable the surious warnings for the mfem header file. |
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.
typo
// Disable the surious warnings for the mfem header file. | |
// Disable the spurious warnings for the mfem header file. |
|
||
#define SUBCLASS(A, B) \ | ||
/* Functions to cast A to a superclass B. */ \ | ||
/* In C++ so errors can be caught by the type system */ \ |
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.
👍
let mut mesh_fec = mesh.with_fec(|fec| { | ||
if args.order > 0 { | ||
H1_FECollection::new(args.order, dim).into() | ||
} else if let Some(fec) = fec { | ||
fec.into() | ||
} else { | ||
H1_FECollection::new(1, dim).into() | ||
} | ||
}; |
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.
This pattern is much cleaner than the original mess that was here.
Thanks! :)
/// `FiniteElementCollection` returned by `fec` is the one that | ||
/// will be used to discretize the PDE. | ||
#[must_use] | ||
pub fn with_fec<'a, FEC>(&'a mut self, fec: FEC) -> MeshWithFEC<'a> |
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.
pub fn with_fec<'a, FEC>(&'a mut self, fec: FEC) -> MeshWithFEC<'a> | |
pub fn map_fec<'a, FecFunc>(&'a mut self, f: FecFunc) -> MeshWithFEC<'a> |
The name with_fec
feels odd, because all other with_$X
functions are part of a "builder pattern". This one is the odd one out, for two main reasons.
First, all other "builder pattern" functions return an entirely independent new thing. This one returns something that holds a reference to the original.
Second, all other "builder pattern" functions take a plain-old-data value that is meant to replace the original value, without regard to what it was. This one processes the original value to produce the new value.
Mostly for the second reason, a name of map_$X
form seems easier to understand.
@Chris00 I just realized I had made a mistake opening this - GitHub doesn't allow the opener to accept a PR... 🙈 Last item I can think of before we merge |
On 5 May 2025 at 06:04 +02, Máté Kovács ***@***.***> wrote:
[…] Last item I can think of before we merge autocxx is to port
example0, as you suggested earlier.
I'll try to act on you comments ASAP but this week I have some reports to urgently finish.
One other item I thought about adding is an example use of `Mut`. My idea is to add Mesh::get_element_mut but it may require a few additional modifications (`Element` is an abstract class that autocxx does not bind automatically).
|
Just for easy comparison with
main
.