mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-08 22:37:28 +05:00
tracer in Netgen
This commit is contained in:
parent
f7c658c6d0
commit
5469356147
@ -97,12 +97,15 @@ void ParallelFor( int first, int next, const TFunc & f )
|
|||||||
|
|
||||||
|
|
||||||
typedef void (*TaskManager)(std::function<void(int,int)>);
|
typedef void (*TaskManager)(std::function<void(int,int)>);
|
||||||
|
typedef void (*Tracer)(string, bool); // false .. start, true .. stop
|
||||||
|
|
||||||
inline void DummyTaskManager (std::function<void(int,int)> func)
|
inline void DummyTaskManager (std::function<void(int,int)> func)
|
||||||
{
|
{
|
||||||
func(0,2);
|
func(0,2);
|
||||||
func(1,2);
|
func(1,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void DummyTracer (string, bool) { ; }
|
||||||
|
|
||||||
template <typename FUNC>
|
template <typename FUNC>
|
||||||
inline void ParallelFor (TaskManager tm, size_t n, FUNC func)
|
inline void ParallelFor (TaskManager tm, size_t n, FUNC func)
|
||||||
|
@ -199,6 +199,7 @@ namespace netgen
|
|||||||
|
|
||||||
inline void DummyTaskManager2 (function<void(int,int)> func)
|
inline void DummyTaskManager2 (function<void(int,int)> func)
|
||||||
{ func(0,1); }
|
{ func(0,1); }
|
||||||
|
inline void DummyTracer2 (string, bool) { ; }
|
||||||
|
|
||||||
class DLL_HEADER Ngx_Mesh
|
class DLL_HEADER Ngx_Mesh
|
||||||
{
|
{
|
||||||
@ -276,7 +277,8 @@ namespace netgen
|
|||||||
// std::pair<int,int> GetBoundaryNeighbouringDomains (int bnr);
|
// std::pair<int,int> GetBoundaryNeighbouringDomains (int bnr);
|
||||||
|
|
||||||
void Refine (NG_REFINEMENT_TYPE reftype,
|
void Refine (NG_REFINEMENT_TYPE reftype,
|
||||||
void (*taskmanager)(function<void(int,int)>) = &DummyTaskManager2);
|
void (*taskmanager)(function<void(int,int)>) = &DummyTaskManager2,
|
||||||
|
void (*tracer)(string, bool) = &DummyTracer2);
|
||||||
|
|
||||||
|
|
||||||
// Find element of point, returns local coordinates
|
// Find element of point, returns local coordinates
|
||||||
|
@ -989,7 +989,8 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
void Ngx_Mesh :: Refine (NG_REFINEMENT_TYPE reftype,
|
void Ngx_Mesh :: Refine (NG_REFINEMENT_TYPE reftype,
|
||||||
void (*task_manager)(function<void(int,int)>))
|
void (*task_manager)(function<void(int,int)>),
|
||||||
|
Tracer tracer)
|
||||||
{
|
{
|
||||||
NgLock meshlock (mesh->MajorMutex(), 1);
|
NgLock meshlock (mesh->MajorMutex(), 1);
|
||||||
|
|
||||||
@ -1002,11 +1003,14 @@ namespace netgen
|
|||||||
if (reftype == NG_REFINE_HP)
|
if (reftype == NG_REFINE_HP)
|
||||||
biopt.refine_hp = 1;
|
biopt.refine_hp = 1;
|
||||||
biopt.task_manager = task_manager;
|
biopt.task_manager = task_manager;
|
||||||
|
biopt.tracer = tracer;
|
||||||
|
|
||||||
const Refinement & ref = mesh->GetGeometry()->GetRefinement();
|
const Refinement & ref = mesh->GetGeometry()->GetRefinement();
|
||||||
ref.Bisect (*mesh, biopt);
|
ref.Bisect (*mesh, biopt);
|
||||||
|
|
||||||
|
(*tracer)("call updatetop", false);
|
||||||
mesh -> UpdateTopology(task_manager);
|
mesh -> UpdateTopology(task_manager);
|
||||||
|
(*tracer)("call updatetop", true);
|
||||||
mesh -> GetCurvedElements().SetIsHighOrder (false);
|
mesh -> GetCurvedElements().SetIsHighOrder (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2667,6 +2667,8 @@ namespace netgen
|
|||||||
static int timer_bisecttrig = NgProfiler::CreateTimer ("Bisect trigs");
|
static int timer_bisecttrig = NgProfiler::CreateTimer ("Bisect trigs");
|
||||||
static int timer_bisectsegms = NgProfiler::CreateTimer ("Bisect segms");
|
static int timer_bisectsegms = NgProfiler::CreateTimer ("Bisect segms");
|
||||||
NgProfiler::RegionTimer reg1 (timer);
|
NgProfiler::RegionTimer reg1 (timer);
|
||||||
|
|
||||||
|
(*opt.tracer)("Bisect", false);
|
||||||
|
|
||||||
NgProfiler::StartTimer (timer1);
|
NgProfiler::StartTimer (timer1);
|
||||||
NgProfiler::StartTimer (timer1a);
|
NgProfiler::StartTimer (timer1a);
|
||||||
@ -3218,6 +3220,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
// refine volume elements
|
// refine volume elements
|
||||||
NgProfiler::StartTimer (timer_bisecttet);
|
NgProfiler::StartTimer (timer_bisecttet);
|
||||||
|
(*opt.tracer)("bisecttet", false);
|
||||||
int nel = mtets.Size();
|
int nel = mtets.Size();
|
||||||
for (int i = 1; i <= nel; i++)
|
for (int i = 1; i <= nel; i++)
|
||||||
if (mtets.Elem(i).marked)
|
if (mtets.Elem(i).marked)
|
||||||
@ -3250,6 +3253,7 @@ namespace netgen
|
|||||||
mesh.mlparentelement.Append (i);
|
mesh.mlparentelement.Append (i);
|
||||||
}
|
}
|
||||||
NgProfiler::StopTimer (timer_bisecttet);
|
NgProfiler::StopTimer (timer_bisecttet);
|
||||||
|
(*opt.tracer)("bisecttet", true);
|
||||||
int npr = mprisms.Size();
|
int npr = mprisms.Size();
|
||||||
for (int i = 1; i <= npr; i++)
|
for (int i = 1; i <= npr; i++)
|
||||||
if (mprisms.Elem(i).marked)
|
if (mprisms.Elem(i).marked)
|
||||||
@ -3886,7 +3890,8 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*opt.tracer)("Bisect", true);
|
||||||
|
|
||||||
// Repair works only for tets!
|
// Repair works only for tets!
|
||||||
bool do_repair = mesh.PureTetMesh ();
|
bool do_repair = mesh.PureTetMesh ();
|
||||||
@ -4020,8 +4025,10 @@ namespace netgen
|
|||||||
NgProfiler::StopTimer (timer2);
|
NgProfiler::StopTimer (timer2);
|
||||||
NgProfiler::StartTimer (timer3);
|
NgProfiler::StartTimer (timer3);
|
||||||
|
|
||||||
NgProfiler::StartTimer (timer3a);
|
NgProfiler::StartTimer (timer3a);
|
||||||
|
(*opt.tracer)("topology from bisect", false);
|
||||||
mesh.UpdateTopology(opt.task_manager);
|
mesh.UpdateTopology(opt.task_manager);
|
||||||
|
(*opt.tracer)("topology from bisect", true);
|
||||||
NgProfiler::StopTimer (timer3a);
|
NgProfiler::StopTimer (timer3a);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
bool refine_hp;
|
bool refine_hp;
|
||||||
bool refine_p;
|
bool refine_p;
|
||||||
TaskManager task_manager = &DummyTaskManager;
|
TaskManager task_manager = &DummyTaskManager;
|
||||||
|
Tracer tracer = &DummyTracer;
|
||||||
DLL_HEADER BisectionOptions ();
|
DLL_HEADER BisectionOptions ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user