tracer in Netgen

This commit is contained in:
Joachim Schöberl 2018-01-04 10:43:22 +01:00
parent f7c658c6d0
commit 5469356147
5 changed files with 22 additions and 5 deletions

View File

@ -97,12 +97,15 @@ void ParallelFor( int first, int next, const TFunc & f )
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)
{
func(0,2);
func(1,2);
}
inline void DummyTracer (string, bool) { ; }
template <typename FUNC>
inline void ParallelFor (TaskManager tm, size_t n, FUNC func)

View File

@ -199,6 +199,7 @@ namespace netgen
inline void DummyTaskManager2 (function<void(int,int)> func)
{ func(0,1); }
inline void DummyTracer2 (string, bool) { ; }
class DLL_HEADER Ngx_Mesh
{
@ -276,7 +277,8 @@ namespace netgen
// std::pair<int,int> GetBoundaryNeighbouringDomains (int bnr);
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

View File

@ -989,7 +989,8 @@ namespace netgen
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);
@ -1002,11 +1003,14 @@ namespace netgen
if (reftype == NG_REFINE_HP)
biopt.refine_hp = 1;
biopt.task_manager = task_manager;
biopt.tracer = tracer;
const Refinement & ref = mesh->GetGeometry()->GetRefinement();
ref.Bisect (*mesh, biopt);
(*tracer)("call updatetop", false);
mesh -> UpdateTopology(task_manager);
(*tracer)("call updatetop", true);
mesh -> GetCurvedElements().SetIsHighOrder (false);
}

View File

@ -2667,6 +2667,8 @@ namespace netgen
static int timer_bisecttrig = NgProfiler::CreateTimer ("Bisect trigs");
static int timer_bisectsegms = NgProfiler::CreateTimer ("Bisect segms");
NgProfiler::RegionTimer reg1 (timer);
(*opt.tracer)("Bisect", false);
NgProfiler::StartTimer (timer1);
NgProfiler::StartTimer (timer1a);
@ -3218,6 +3220,7 @@ namespace netgen
{
// refine volume elements
NgProfiler::StartTimer (timer_bisecttet);
(*opt.tracer)("bisecttet", false);
int nel = mtets.Size();
for (int i = 1; i <= nel; i++)
if (mtets.Elem(i).marked)
@ -3250,6 +3253,7 @@ namespace netgen
mesh.mlparentelement.Append (i);
}
NgProfiler::StopTimer (timer_bisecttet);
(*opt.tracer)("bisecttet", true);
int npr = mprisms.Size();
for (int i = 1; i <= npr; i++)
if (mprisms.Elem(i).marked)
@ -3886,7 +3890,8 @@ namespace netgen
}
}
}
(*opt.tracer)("Bisect", true);
// Repair works only for tets!
bool do_repair = mesh.PureTetMesh ();
@ -4020,8 +4025,10 @@ namespace netgen
NgProfiler::StopTimer (timer2);
NgProfiler::StartTimer (timer3);
NgProfiler::StartTimer (timer3a);
NgProfiler::StartTimer (timer3a);
(*opt.tracer)("topology from bisect", false);
mesh.UpdateTopology(opt.task_manager);
(*opt.tracer)("topology from bisect", true);
NgProfiler::StopTimer (timer3a);

View File

@ -13,6 +13,7 @@ public:
bool refine_hp;
bool refine_p;
TaskManager task_manager = &DummyTaskManager;
Tracer tracer = &DummyTracer;
DLL_HEADER BisectionOptions ();
};