#ifndef NONLINCF_H #define NONLINCF_H #include <fem.hpp> #include <solve.hpp> #include <ngstd.hpp> #include <vector> #include <cmath> #include <memory> #include <iostream> #include <cmath> #include <cstring> #include "../basicClasses/ngData_class.h" #include "../basicClasses/magCurve.h" using namespace ngstd; using namespace ngfem; using namespace ngsolve; using namespace ngcomp; // #define _Pi 3.141592653589793 template <unsigned int DIM> std::pair<unsigned int, unsigned int> findNearestNeighbour(const vector<vector<MappedIntegrationPoint<DIM, DIM>> > & mips, const BaseMappedIntegrationPoint& mip); template <typename T, unsigned int DIM> class nonLinCF:public CoefficientFunction { public: nonLinCF(shared_ptr<MeshAccess>& mesh, IntegrationRule& intrule, const shared_ptr<CoefficientFunction>& ptrInput, vector<double> H_KL, vector<double> B_KL, const std::string cFieldIn="H", const std::string cFieldOut="B", const shared_ptr<CoefficientFunction>& ptrMask=nullptr, unsigned int order=1); ~nonLinCF() = default; bool HasConverged(double aMeanError, double aMaxError) const; void Update(); void UpdateEnergyDensity(); const shared_ptr<ngScalar_class<T, DIM>> GetEnergyDensity(); unsigned int getOrder() const; KL GetKL(); virtual double Evaluate(const BaseMappedIntegrationPoint& mip) const override; shared_ptr<CoefficientFunction> GetInputCF(); private: shared_ptr<CoefficientFunction> ptrInput; const std::string sFieldIn; const std::string sFieldOut; shared_ptr<CoefficientFunction> ptrMask; // data shared_ptr<ngScalar_class<T, DIM>> ptrData; shared_ptr<ngScalar_class<T, DIM>> ptrEnergyDens; vector<vector<MappedIntegrationPoint<DIM, DIM>> > mips; std::shared_ptr<KL> oKL; double meanError; double maxError; }; #endif /* NONLINCF_H */