Hi,
The DPG library has some useful NumProcs written in C++ and used by pde files. I was wondering if it would be possible to bring those NumProcs into Python in the same way we can bring in spaces and elements using ctypes.CDLL.
For example, we have in ‘fluxerr.cpp’:
template<typename SCAL>
class NumProcFluxError : public NumProc { ...
NumProcFluxError ( shared_ptr<PDE> apde, const Flags & flags) : NumProc(apde) {
fes = GetPDE()->GetFESpace(flags.GetStringFlag("fespace",NULL));
ext = GetPDE()->GetFESpace(flags.GetStringFlag("extensionspace",NULL));
hdivip = GetPDE()->GetBilinearForm(flags.GetStringFlag("hdivproduct",NULL));
q = GetPDE()->GetGridFunction(flags.GetStringFlag("discreteq",NULL));
Q = GetPDE()->GetGridFunction(flags.GetStringFlag("exactq",NULL));
err = GetPDE()->GetGridFunction(flags.GetStringFlag("errorsquareq",NULL));
}
...
}
static RegisterNumProc<NumProcFluxError<double>> npinitfluxerr("fluxerr");
Then in a pde file:
shared = "../libDPG"
...
numproc fluxerr calc_fluxerror_fracnorm # Calculate ||q - Q||.
-exactq=qex -discreteq=qRT -extensionspace=RT
-fespace=fs -hdivproduct=hdivipe -errorsquareq=qerrsqr
This works, but in Python,
[code]from ctypes import CDLL
from ngsolve import *
libDPG = CDLL(“…/libDPG.so”)
…
np = NumProc(‘fluxerr’, exactq=qex, discreteq=qRT, extensionspace=RT,\
fespace=fs, hdivproduct=hdivipe, errorsquareq=qerrsqr)[/code]
gives “TypeError: ngsolve.comp.NumProc: No constructor defined!”