T_GridFunction deprecated (C++ only)

More
5 years 10 months ago #1453 by joachim
We used to have the class hierarchy

GridFunction -> S_GridFunction<SCAL> -> T_GridFunction<T>

where SCAL is real/complex and T is something like double, Vec<3,double>, Vec<9,Complex>

This required a compile-time fixed maximal system dimension. Now we use only S_GridFunction, and the dimension is a runtime variable.

This change may need adaption of user C++ code:
If you use

VVector<Vec<3>> & vecwd = dynamic_cast<VVector<Vec<3>> &> (gf_wd->GetVector());

it throws now a dynamic cast exception.

You have to replace it by

FlatVector<Vec<3>> vecwd = gf_wd->GetVector().FV<Vec<3>>();


You can wrap it into a VFlatVector<Vec<3>> if you need a member of the BaseVector family.


Sorry for the change, but now you can do a GridFunctions of dimension 21, as some turbulence people asked for.

Joachim
More
5 years 10 months ago #1454 by armandyam
Thank you for the correction. One small follow up question.

How exactly should we change the definition of the variable "gf_wd"

before we had to do

shared_ptr<GridFunction> gf_wd;
gf_wd = make_shared<T_GridFunction<Vec<3> > > (*fes_scalar, "walldistance", gfflags);
apde->AddGridFunction ("walldistance", gf_wd);

Now perhaps there has to be a change to be made here.

I (perhaps naively) tried something like:

shared_ptr<GridFunction> gf_wd;
gf_wd = make_shared<S_GridFunction<double> >(fes_scalar, "WallDistance", gfflags);
apde->AddGridFunction ("WallDistance", gf_wd);

but ended up with a run time error "errmsg: dlopen(./main.so, 9): Symbol not found"

Thanks again!
Time to create page: 0.105 seconds