diff --git a/C++/multiscale/MSnonlin.cc b/C++/multiscale/MSnonlin.cc index 5e423d09adc5157abc649aac9406aee7ca29d0c3..76518dcecf75be701c45abd2cb19f309b5f27354 100644 --- a/C++/multiscale/MSnonlin.cc +++ b/C++/multiscale/MSnonlin.cc @@ -30,7 +30,7 @@ MuNonLinMS<DIM>::MuNonLinMS( const shared_ptr<MSWrapperVec<double, DIM>>& HorB - HorB_scalar = std::make_shared<ngScalar_class_extended<double, DIM>>(HorB->getMesh(), HorB->getIntrule(), HorB->getMips(), HorB->getLocalPoints(), HorB->getOrientation()); + // HorB_scalar = std::make_shared<ngScalar_class_extended<double, DIM>>(HorB->getMesh(), HorB->getIntrule(), HorB->getMips(), HorB->getLocalPoints(), HorB->getOrientation()); mu_local = std::make_shared<ngData_class_extended<mat_t<double, 1, 1>, DIM>>(HorB->getMesh(), HorB->getIntrule(), HorB->getMips(), HorB->getLocalPoints(), HorB->getOrientation()); // init for biro approach @@ -69,7 +69,7 @@ void MuNonLinMS<DIM>::findConcavePoints(){ template<unsigned int DIM> std::shared_ptr<ngScalar_class<double, DIM>> MuNonLinMS<DIM>::getSheetStructurCF(const double zheight_SingleSheet, const unsigned int iNumLayers, const double dFillFactor){ - ptrStructureCF = std::make_shared<ngScalar_class<double, DIM>>(HorB_scalar->getMesh(),HorB_scalar->getIntrule(), HorB->getMips()); + ptrStructureCF = std::make_shared<ngScalar_class<double, DIM>>(HorB->getMesh(),HorB->getIntrule(), HorB->getMips()); for (unsigned int el = 0; el < HorB->getMips().size(); el++) { // skip unmasked elements @@ -116,21 +116,22 @@ void MuNonLinMS<DIM>::Update(){ // Convert to a saclar value from wrapper //for (int el = 0; el < mips.size(); el++) { parFor(HorB->getMips().size(), [&](unsigned int el) { - + double val_in; for (unsigned int p = 0; p < HorB->getMips()[el].size(); p++) { // skip unmasked elements // if(ptrMask == nullptr || ptrMask->Evaluate(HorB->getMips()[el][p]) != 0){ for (unsigned int i = 0;i < HorB->NPoints();i++) { // set input value + if(component >= 3) - HorB_scalar->Set(el, p, i, HorB->getValue(el, p, i).norm()); // std::abs due to possiblity of T... complex<double> + val_in = HorB->getValue(el, p, i).norm(); // std::abs due to possiblity of T... complex<double> else if(component == 0) - HorB_scalar->Set(el, p, i, HorB->getValue(el, p, i).first()); + val_in = HorB->getValue(el, p, i).first(); else if(component == 1) - HorB_scalar->Set(el, p, i, HorB->getValue(el, p, i).second()); + val_in = HorB->getValue(el, p, i).second(); else if(component == 2) - HorB_scalar->Set(el, p, i, HorB->getValue(el, p, i).third()); + val_in = HorB->getValue(el, p, i).third(); else{ throw std::runtime_error("not a correct component"); } @@ -138,16 +139,12 @@ void MuNonLinMS<DIM>::Update(){ // cout << HorB->getValue(el, p, i).norm() << " " << HorB->getValue(el, p, i).first() << endl; // update mu_local - - double val_in; - - val_in = HorB_scalar->Get(el, p, i).norm(); - - if(std::abs(val_in) < 1e-6){ + val_in = std::abs(val_in); + if(val_in < 1e-6){ val_in = 1e-6; } - if (usePreisBiro && std::abs(val_in) <= concaveH && !differential){ + if (usePreisBiro && val_in <= concaveH && !differential){ // double b = h*pastMu[el][p]; // double hnew = bh->GetHfromB(b); // return b / hnew; @@ -156,12 +153,11 @@ void MuNonLinMS<DIM>::Update(){ } if(differential){ - mu_local->Set(el, p, i, oKL->DifferentiateH(val_in)); + mu_local->Set(el, p, i, oKL->DifferentiateH(val_in)); } else{ mu_local->Set(el, p, i, oKL->EvaluateH(val_in)/val_in ); - } - + } } // } } diff --git a/C++/multiscale/MSnonlin.h b/C++/multiscale/MSnonlin.h index 971ce00b11ba9e17e08f17ce3eed4f5deede5af0..6a8492a69a58c6bac1c4cc271e4cf1d9e204f340 100644 --- a/C++/multiscale/MSnonlin.h +++ b/C++/multiscale/MSnonlin.h @@ -86,9 +86,9 @@ class MuNonLinMS{ void Update(); void Test(); - std::shared_ptr<ngScalar_class_extended<double, DIM>> getHorB_scalar()const{ - return HorB_scalar; - }; + // std::shared_ptr<ngScalar_class_extended<double, DIM>> getHorB_scalar()const{ + // return HorB_scalar; + // }; std::shared_ptr<ngData_class_extended<mat_t<double, 1, 1>, DIM>> getMu_local()const{ return mu_local; @@ -119,7 +119,7 @@ class MuNonLinMS{ shared_ptr<MSWrapperVec<double, DIM>> HorB; - std::shared_ptr<ngScalar_class_extended<double, DIM>> HorB_scalar; // input + // std::shared_ptr<ngScalar_class_extended<double, DIM>> HorB_scalar; // input std::shared_ptr<ngData_class_extended<mat_t<double, 1, 1>, DIM>> mu_local; diff --git a/C++/multiscale/libMultiscale.cc b/C++/multiscale/libMultiscale.cc index e6771e2970d56423801bbd86f2eb1ec2db88ea2c..1f236cb1ddab75543f8daa0afc575544b43713b5 100644 --- a/C++/multiscale/libMultiscale.cc +++ b/C++/multiscale/libMultiscale.cc @@ -63,7 +63,7 @@ template<unsigned int DIM> .def("GetKL", &MuNonLinMS<DIM>::GetKL, "get the magnetisation curve ") .def("SetData", &MuNonLinMS<DIM>::setData, "copy the data of another MuNonLinMS") .def("SetConcavePoints", &MuNonLinMS<DIM>::setConcavePoints, "set the concave convex points for mu PreisBiro") - .def_property_readonly("HorB_scalar", &MuNonLinMS<DIM>::getHorB_scalar) + // .def_property_readonly("HorB_scalar", &MuNonLinMS<DIM>::getHorB_scalar) .def_property_readonly("mu_local", &MuNonLinMS<DIM>::getMu_local) ; }