C++ Not Allowed? #1684
-
Hello, According to the document,
It sounds like using class syntax is not allowed in QFunctions at all. Is my understanding true? What is limiting us to C99? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Do you have something specific in mind? I'm not seeing an obvious use case where a plain struct wouldn't work as well as a class, but I also don't use a lot of C++? Some compilation environments (OCCA, SYCL) are pickier, but if you only care about one environment, you can go with whatever that backend successfully compiles, in practice. |
Beta Was this translation helpful? Give feedback.
-
We are exploring if libCEED can be integrated with MOOSE. MOOSE is object-oriented where the user derives its own classes from base MOOSE classes. We were thinking of passing these objects as contexts to QFunctions, typecast them, and call user methods (the user methods might be precompiled, not JIT compiled). So I guess C99 is not a strict restriction and dependent on the backends? |
Beta Was this translation helpful? Give feedback.
Yeah, if you don't care about the OCCA and SYCL backends, it gets a lot easier to experiment. The CPU side just cares about getting a good function pointer for the QFunction and CUDA and HIP can handle whatever syntax CUDA and HIP normally support. The entire definition of that class and its methods would need to be accessible to the JiT backend for compiling, which is where you might run into compile time issues if the entirety of those files with those definitions aren't CUDA/HIP friendly.