Dear Hussein,
It's not a big deal to have the VectorType as a class template. The only 
thing you will get is that every function / member of the class will be 
compiled twice (once for every vector type).
In the software my group develops 
(lethe https://github.com/chaos-polymtl/lethe), some classes are 
instantiated with three vector types (Trilinos::block, Trilinos, dealii 
parallel vectors). This for sure increase compile time, but on a modern 
machine we can still compile the entire 100k line C++ code in less than 3-4 
minutes, so it's not a big deal.
i would not worry about this. It is better to integrate this kind of 
flexibility from the beginning. I would advise you to start also looking 
into the deal.II parallel vectors. They are compatible with the Trilinos 
and PETSC solvers and they work quite well. This templating of the vector 
type actually saved us tremendously when we started to develop our matrix 
free solver.

TLDR: Use a template parameter, compile both versions, you won't suffer 
from it.

Feel free to reach out if you have any questions.

On Friday, February 21, 2025 at 6:48:21 a.m. UTC-5 Hussein Shaito wrote:

> Dear community,
>
> I am trying to write a solver and I want to support both trillinos and 
> petsc vectors at runtime.
> I am doing this by having the vector type as a class template for my 
> solver.
> Since you guys are more experienced than I am, is there a disadvantage for 
> this approach? Will this bloat my compile time if my code grows? Would 
> anyone recommend something else? 
> I know I can do an #ifdef for either pets. and trilinos like in step40 and 
> compile but I would still want to know what you guys suggest. 
>
> Best regards, 
> Hussein.
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/eff32439-4acf-4874-ae3f-a9f14572671bn%40googlegroups.com.

Reply via email to