mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
unique-ptr for TangentialSolid
This commit is contained in:
parent
4f4483794d
commit
4d2e4fea44
@ -970,7 +970,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (int i = 0; i < geometry.GetNTopLevelObjects(); i++)
|
for (int i = 0; i < geometry.GetNTopLevelObjects(); i++)
|
||||||
{
|
{
|
||||||
Solid * locsol;
|
// Solid * locsol;
|
||||||
|
|
||||||
if (geometry.GetTopLevelObject(i)->GetLayer() != layer)
|
if (geometry.GetTopLevelObject(i)->GetLayer() != layer)
|
||||||
continue;
|
continue;
|
||||||
@ -978,7 +978,8 @@ namespace netgen
|
|||||||
const Solid * sol = geometry.GetTopLevelObject(i)->GetSolid();
|
const Solid * sol = geometry.GetTopLevelObject(i)->GetSolid();
|
||||||
const Surface * surf = geometry.GetTopLevelObject(i)->GetSurface();
|
const Surface * surf = geometry.GetTopLevelObject(i)->GetSurface();
|
||||||
|
|
||||||
sol -> TangentialSolid (hp, locsol, locsurfind, size*ideps);
|
// sol -> TangentialSolid (hp, locsol, locsurfind, size*ideps);
|
||||||
|
auto locsol = sol -> TangentialSolid (hp, locsurfind, size*ideps);
|
||||||
|
|
||||||
//*testout << "hp = " << hp << endl;
|
//*testout << "hp = " << hp << endl;
|
||||||
//(*testout) << "locsol: " << endl;
|
//(*testout) << "locsol: " << endl;
|
||||||
@ -995,7 +996,8 @@ namespace netgen
|
|||||||
ReducePrimitiveIterator rpi(boxp);
|
ReducePrimitiveIterator rpi(boxp);
|
||||||
UnReducePrimitiveIterator urpi;
|
UnReducePrimitiveIterator urpi;
|
||||||
|
|
||||||
((Solid*)locsol) -> IterateSolid (rpi);
|
// ((Solid*)locsol) -> IterateSolid (rpi);
|
||||||
|
locsol -> IterateSolid (rpi);
|
||||||
|
|
||||||
locsol -> CalcSurfaceInverse ();
|
locsol -> CalcSurfaceInverse ();
|
||||||
|
|
||||||
@ -1020,7 +1022,8 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
((Solid*)locsol) -> IterateSolid (urpi);
|
// ((Solid*)locsol) -> IterateSolid (urpi);
|
||||||
|
locsol -> IterateSolid (urpi);
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -1259,7 +1262,7 @@ namespace netgen
|
|||||||
m *= -1;
|
m *= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete locsol;
|
// delete locsol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1780,7 +1783,7 @@ namespace netgen
|
|||||||
int nsurf = geometry.GetNSurf();
|
int nsurf = geometry.GetNSurf();
|
||||||
int layer = 0;
|
int layer = 0;
|
||||||
|
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
NgArray<int> tansurfind;
|
NgArray<int> tansurfind;
|
||||||
|
|
||||||
double size = geometry.MaxSize();
|
double size = geometry.MaxSize();
|
||||||
@ -1838,7 +1841,8 @@ namespace netgen
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Solid * sol = geometry.GetTopLevelObject(j)->GetSolid();
|
const Solid * sol = geometry.GetTopLevelObject(j)->GetSolid();
|
||||||
sol -> TangentialSolid (p1, tansol, tansurfind, ideps*size);
|
// sol -> TangentialSolid (p1, tansol, tansurfind, ideps*size);
|
||||||
|
auto tansol = sol -> TangentialSolid (p1, tansurfind, ideps*size);
|
||||||
layer = geometry.GetTopLevelObject(j)->GetLayer();
|
layer = geometry.GetTopLevelObject(j)->GetLayer();
|
||||||
|
|
||||||
|
|
||||||
@ -1868,7 +1872,7 @@ namespace netgen
|
|||||||
// seg.invs1 = surfaces[i] -> Inverse();
|
// seg.invs1 = surfaces[i] -> Inverse();
|
||||||
// seg.invs2 = ! (surfaces[i] -> Inverse());
|
// seg.invs2 = ! (surfaces[i] -> Inverse());
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ void SingularPoint :: FindPoints (class Mesh & mesh)
|
|||||||
for (int k = 1; k <= 3; k++)
|
for (int k = 1; k <= 3; k++)
|
||||||
{
|
{
|
||||||
const Solid * solk(NULL);
|
const Solid * solk(NULL);
|
||||||
Solid *tansol;
|
// Solid *tansol;
|
||||||
switch (k)
|
switch (k)
|
||||||
{
|
{
|
||||||
case 1: solk = sol1; break;
|
case 1: solk = sol1; break;
|
||||||
@ -176,7 +176,7 @@ void SingularPoint :: FindPoints (class Mesh & mesh)
|
|||||||
case 3: solk = sol3; break;
|
case 3: solk = sol3; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
solk -> TangentialSolid (p, tansol, surfk, 1e-3);
|
auto tansol = solk -> TangentialSolid (p, surfk, 1e-3);
|
||||||
(*testout) << "Tansol = " << *tansol << endl;
|
(*testout) << "Tansol = " << *tansol << endl;
|
||||||
|
|
||||||
if (!tansol) continue;
|
if (!tansol) continue;
|
||||||
@ -195,7 +195,7 @@ void SingularPoint :: FindPoints (class Mesh & mesh)
|
|||||||
if (!surf.Contains (surfk[i]))
|
if (!surf.Contains (surfk[i]))
|
||||||
surf.Append (surfk[i]);
|
surf.Append (surfk[i]);
|
||||||
|
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surf.Size() < 3) continue;
|
if (surf.Size() < 3) continue;
|
||||||
|
@ -638,13 +638,15 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Solid :: TangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids, double eps) const
|
unique_ptr<Solid> Solid :: TangentialSolid (const Point<3> & p, NgArray<int> & surfids, double eps) const
|
||||||
{
|
{
|
||||||
int in, strin;
|
int in, strin;
|
||||||
|
Solid * tansol = nullptr;
|
||||||
RecTangentialSolid (p, tansol, surfids, in, strin, eps);
|
RecTangentialSolid (p, tansol, surfids, in, strin, eps);
|
||||||
surfids.SetSize (0);
|
surfids.SetSize (0);
|
||||||
if (tansol)
|
if (tansol)
|
||||||
tansol -> GetTangentialSurfaceIndices (p, surfids, eps);
|
tansol -> GetTangentialSurfaceIndices (p, surfids, eps);
|
||||||
|
return unique_ptr<Solid> (tansol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
/// compute localization in point p
|
/// compute localization in point p
|
||||||
void TangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids, double eps) const;
|
unique_ptr<Solid> TangentialSolid (const Point<3> & p, NgArray<int> & surfids, double eps) const;
|
||||||
|
|
||||||
/// compute localization in point p tangential to vector t
|
/// compute localization in point p tangential to vector t
|
||||||
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
|
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
|
||||||
|
@ -289,8 +289,8 @@ namespace netgen
|
|||||||
for (int j = 0; j < pts.Size(); j++)
|
for (int j = 0; j < pts.Size(); j++)
|
||||||
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
||||||
{
|
{
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
sol -> TangentialSolid (pts[j], tansol, surfids, 1e-9*size);
|
auto tansol = sol -> TangentialSolid (pts[j], surfids, 1e-9*size);
|
||||||
|
|
||||||
if(!tansol)
|
if(!tansol)
|
||||||
continue;
|
continue;
|
||||||
@ -314,7 +314,7 @@ namespace netgen
|
|||||||
if (AddPoint (pts[j], layer))
|
if (AddPoint (pts[j], layer))
|
||||||
(*testout) << "cross point found, 1: " << pts[j] << endl;
|
(*testout) << "cross point found, 1: " << pts[j] << endl;
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,8 +333,8 @@ namespace netgen
|
|||||||
for (int j = 0; j < pts.Size(); j++)
|
for (int j = 0; j < pts.Size(); j++)
|
||||||
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
||||||
{
|
{
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
sol -> TangentialSolid (pts[j], tansol, surfids, 1e-9*size);
|
auto tansol = sol -> TangentialSolid (pts[j], surfids, 1e-9*size);
|
||||||
|
|
||||||
if(!tansol)
|
if(!tansol)
|
||||||
continue;
|
continue;
|
||||||
@ -358,7 +358,7 @@ namespace netgen
|
|||||||
if (AddPoint (pts[j], layer))
|
if (AddPoint (pts[j], layer))
|
||||||
(*testout) << "cross point found, 2: " << pts[j] << endl;
|
(*testout) << "cross point found, 2: " << pts[j] << endl;
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,15 +372,15 @@ namespace netgen
|
|||||||
for (int j = 0; j < pts.Size(); j++)
|
for (int j = 0; j < pts.Size(); j++)
|
||||||
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
||||||
{
|
{
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
sol -> TangentialSolid (pts[j], tansol, surfids, 1e-9*size);
|
auto tansol = sol -> TangentialSolid (pts[j], surfids, 1e-9*size);
|
||||||
if (tansol)
|
if (tansol)
|
||||||
// sol -> IsIn (pts[j], 1e-6*size) && !sol->IsStrictIn (pts[j], 1e-6*size) )
|
// sol -> IsIn (pts[j], 1e-6*size) && !sol->IsStrictIn (pts[j], 1e-6*size) )
|
||||||
{
|
{
|
||||||
if (AddPoint (pts[j], layer))
|
if (AddPoint (pts[j], layer))
|
||||||
(*testout) << "extremal point found, 1: " << pts[j] << endl;
|
(*testout) << "extremal point found, 1: " << pts[j] << endl;
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,8 +409,8 @@ namespace netgen
|
|||||||
for (int j = 0; j < pts.Size(); j++)
|
for (int j = 0; j < pts.Size(); j++)
|
||||||
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
||||||
{
|
{
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
sol -> TangentialSolid (pts[j], tansol, surfids, 1e-9*size);
|
auto tansol = sol -> TangentialSolid (pts[j], surfids, 1e-9*size);
|
||||||
|
|
||||||
if(!tansol)
|
if(!tansol)
|
||||||
continue;
|
continue;
|
||||||
@ -434,7 +434,7 @@ namespace netgen
|
|||||||
if (AddPoint (pts[j], layer))
|
if (AddPoint (pts[j], layer))
|
||||||
(*testout) << "cross point found, 1: " << pts[j] << endl;
|
(*testout) << "cross point found, 1: " << pts[j] << endl;
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,15 +449,15 @@ namespace netgen
|
|||||||
for (int j = 0; j < pts.Size(); j++)
|
for (int j = 0; j < pts.Size(); j++)
|
||||||
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
if (Dist (pts[j], box.Center()) < box.Diam()/2)
|
||||||
{
|
{
|
||||||
Solid * tansol;
|
// Solid * tansol;
|
||||||
sol -> TangentialSolid (pts[j], tansol, surfids, 1e-9*size);
|
auto tansol = sol -> TangentialSolid (pts[j], surfids, 1e-9*size);
|
||||||
if (tansol)
|
if (tansol)
|
||||||
// sol -> IsIn (pts[j], 1e-6*size) && !sol->IsStrictIn (pts[j], 1e-6*size) )
|
// sol -> IsIn (pts[j], 1e-6*size) && !sol->IsStrictIn (pts[j], 1e-6*size) )
|
||||||
{
|
{
|
||||||
if (AddPoint (pts[j], layer))
|
if (AddPoint (pts[j], layer))
|
||||||
(*testout) << "extremal point found, spheres: " << pts[j] << endl;
|
(*testout) << "extremal point found, spheres: " << pts[j] << endl;
|
||||||
}
|
}
|
||||||
delete tansol;
|
// delete tansol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1829,8 +1829,8 @@ namespace netgen
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
Solid * locsol;
|
// Solid * locsol;
|
||||||
sol -> TangentialSolid (p, locsol, surfind, ideps*geomsize);
|
auto locsol = sol -> TangentialSolid (p, surfind, ideps*geomsize);
|
||||||
|
|
||||||
|
|
||||||
rep_surfind.SetSize (surfind.Size());
|
rep_surfind.SetSize (surfind.Size());
|
||||||
@ -2158,7 +2158,7 @@ namespace netgen
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete locsol;
|
// delete locsol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user