diff --git a/src/DCPSE/DCPSE_op/tests/DCPSE_op_Surface_tests.cpp b/src/DCPSE/DCPSE_op/tests/DCPSE_op_Surface_tests.cpp index 3664e8627074a4b2c4380c00f39c0a5480aa32c8..3fd8d03fd497e1698057a490ee5b92ad98744683 100644 --- a/src/DCPSE/DCPSE_op/tests/DCPSE_op_Surface_tests.cpp +++ b/src/DCPSE/DCPSE_op/tests/DCPSE_op_Surface_tests.cpp @@ -830,7 +830,7 @@ BOOST_AUTO_TEST_CASE(dcpse_surface_sphere_old) { } domain.ghost_get<1,2,3>(); - SurfaceDerivative_xx<6> Dxx(domain, 2, rCut,1.0,support_options::ADAPTIVE_SURFACE); + SurfaceDerivative_xx<6> Dxx(domain, 2, rCut,3.9,support_options::ADAPTIVE_SURFACE); /* v=0; auto itNNN=domain.getDomainIterator(); @@ -846,8 +846,8 @@ BOOST_AUTO_TEST_CASE(dcpse_surface_sphere_old) { //Dxx.DrawKernel<5,decltype(domain)>(domain,6161); //domain.write_frame("Kernel",6161); - SurfaceDerivative_yy<6> Dyy(domain, 2, rCut,1.0,support_options::ADAPTIVE_SURFACE); - SurfaceDerivative_zz<6> Dzz(domain, 2, rCut,1.0,support_options::ADAPTIVE_SURFACE); + SurfaceDerivative_yy<6> Dyy(domain, 2, rCut,3.9,support_options::ADAPTIVE_SURFACE); + SurfaceDerivative_zz<6> Dzz(domain, 2, rCut,3.9,support_options::ADAPTIVE_SURFACE); Dxx.save(domain,"Sdxx_test"); Dyy.save(domain,"Sdyy_test"); @@ -1076,9 +1076,9 @@ BOOST_AUTO_TEST_CASE(dcpse_surface_sphere_old) { } domain.ghost_get<1,2,3>(); - SurfaceDerivative_xx<6> Dxx(domain, 2, rCut,1.0,support_options::LOAD); - SurfaceDerivative_yy<6> Dyy(domain, 2, rCut,1.0,support_options::LOAD); - SurfaceDerivative_zz<6> Dzz(domain, 2, rCut,1.0,support_options::LOAD); + SurfaceDerivative_xx<6> Dxx(domain, 2, rCut,3.9,support_options::LOAD); + SurfaceDerivative_yy<6> Dyy(domain, 2, rCut,3.9,support_options::LOAD); + SurfaceDerivative_zz<6> Dzz(domain, 2, rCut,3.9,support_options::LOAD); Dxx.load(domain,"Sdxx_test"); Dyy.load(domain,"Sdyy_test"); Dzz.load(domain,"Sdzz_test"); diff --git a/src/DCPSE/Dcpse.hpp b/src/DCPSE/Dcpse.hpp index c7ca10234ac2d1b1225a0d72d65bdfb600b766a9..2388bdd09b50169783bb8c7ea5fb9d66f0d86b35 100644 --- a/src/DCPSE/Dcpse.hpp +++ b/src/DCPSE/Dcpse.hpp @@ -75,7 +75,7 @@ private: openfpm::vector<T> nSpacings; vector_type & particlesFrom; vector_type2 & particlesTo; - double rCut,supportSizeFactor=1,nSpacing; + double rCut,supportSizeFactor=1,nSpacing,AdapFac; unsigned int convergenceOrder,nCount; bool isSurfaceDerivative=false; @@ -213,19 +213,20 @@ public: particles.ghost_get_subset(); // This communicates which ghost particles to be excluded from support if(opt==support_options::ADAPTIVE_SURFACE) { + this->AdapFac=nSpacing; if(dim==2){ nCount=3; } else{ nCount=2; } - SupportBuilder<vector_type,vector_type2> + SupportBuilder<vector_type,vector_type2> supportBuilder(particlesFrom,particlesTo, differentialSignature, rCut, differentialOrder == 0); - + supportBuilder.setAdapFac(nSpacing); auto it = particlesTo.getDomainAndGhostIterator(); while (it.isNext()) { auto key_o = particlesTo.getOriginKey(it.get()); - Support support = supportBuilder.getSupport(it,nSpacing,opt); + Support support = supportBuilder.getSupport(it,monomialBasis.size(),opt); nSpacings.add(supportBuilder.getLastAvgspacing()); ++it; } @@ -869,6 +870,7 @@ private: SupportBuilder<vector_type,vector_type2> supportBuilder(particlesFrom,particlesTo, differentialSignature, rCut, differentialOrder == 0); unsigned int requiredSupportSize = monomialBasis.size() * supportSizeFactor; + supportBuilder.setAdapFac(AdapFac); if (!isSharedLocalSupport) localSupports.resize(particlesTo.size_local_orig()); diff --git a/src/DCPSE/SupportBuilder.hpp b/src/DCPSE/SupportBuilder.hpp index 404ea3afa566ca13e693b73da61fdd04af4dd418..bae44b36c48e7fd4a867fe1356927ef3e4eec2e7 100644 --- a/src/DCPSE/SupportBuilder.hpp +++ b/src/DCPSE/SupportBuilder.hpp @@ -30,7 +30,7 @@ private: vector_type2 &domainTo; decltype(std::declval<vector_type>().getCellList(0.0)) cellList; const Point<vector_type::dims, unsigned int> differentialSignature; - typename vector_type::stype rCut, AvgSpacing; + typename vector_type::stype rCut, AvgSpacing, AdapFac=1; bool is_interpolation; public: @@ -86,6 +86,10 @@ public: return this->AvgSpacing; } + void setAdapFac(typename vector_type::stype fac) { + this->AdapFac=fac; + } + private: size_t getCellLinId(const grid_key_dx<vector_type::dims> &cellKey) { @@ -206,7 +210,7 @@ private: } } for (int i = 0; i < rp.size(); i++) { - if (rp.get(i).dist < 3.9 * AvgSpacing) { + if (rp.get(i).dist < AdapFac * AvgSpacing) { points.push_back(rp.get(i).offset); } }