mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-27 06:10:34 +05:00
Merge branch 'misc_fixes' into 'master'
Misc fixes See merge request ngsolve/netgen!680
This commit is contained in:
commit
e30677169b
@ -41,6 +41,7 @@ namespace ngcore
|
|||||||
bool PajeTrace::trace_thread_counter = false;
|
bool PajeTrace::trace_thread_counter = false;
|
||||||
bool PajeTrace::trace_threads = true;
|
bool PajeTrace::trace_threads = true;
|
||||||
bool PajeTrace::mem_tracing_enabled = true;
|
bool PajeTrace::mem_tracing_enabled = true;
|
||||||
|
bool PajeTrace::write_paje_file = true;
|
||||||
|
|
||||||
PajeTrace :: PajeTrace(int anthreads, std::string aname)
|
PajeTrace :: PajeTrace(int anthreads, std::string aname)
|
||||||
{
|
{
|
||||||
@ -124,7 +125,7 @@ namespace ngcore
|
|||||||
#endif
|
#endif
|
||||||
if(comm.Size()==1)
|
if(comm.Size()==1)
|
||||||
{
|
{
|
||||||
Write(tracefile_name);
|
Write();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -136,7 +137,7 @@ namespace ngcore
|
|||||||
event.timer_id += NgProfiler::SIZE*comm.Rank();
|
event.timer_id += NgProfiler::SIZE*comm.Rank();
|
||||||
|
|
||||||
if(comm.Rank() == MPI_PAJE_WRITER)
|
if(comm.Rank() == MPI_PAJE_WRITER)
|
||||||
Write(tracefile_name);
|
Write();
|
||||||
else
|
else
|
||||||
SendData();
|
SendData();
|
||||||
}
|
}
|
||||||
@ -443,7 +444,16 @@ namespace ngcore
|
|||||||
|
|
||||||
NGCORE_API PajeTrace *trace;
|
NGCORE_API PajeTrace *trace;
|
||||||
|
|
||||||
void PajeTrace::Write( const std::string & filename )
|
void PajeTrace::Write( )
|
||||||
|
{
|
||||||
|
if(write_paje_file) WritePajeFile( tracefile_name );
|
||||||
|
WriteTimingChart();
|
||||||
|
#ifdef NETGEN_TRACE_MEMORY
|
||||||
|
WriteMemoryChart("");
|
||||||
|
#endif // NETGEN_TRACE_MEMORY
|
||||||
|
}
|
||||||
|
|
||||||
|
void PajeTrace::WritePajeFile( const std::string & filename )
|
||||||
{
|
{
|
||||||
auto n_events = jobs.size() + timer_events.size();
|
auto n_events = jobs.size() + timer_events.size();
|
||||||
for(auto & vtasks : tasks)
|
for(auto & vtasks : tasks)
|
||||||
@ -849,10 +859,6 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteTimingChart();
|
|
||||||
#ifdef NETGEN_TRACE_MEMORY
|
|
||||||
WriteMemoryChart("");
|
|
||||||
#endif // NETGEN_TRACE_MEMORY
|
|
||||||
paje.WriteEvents();
|
paje.WriteEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -961,10 +967,18 @@ namespace ngcore
|
|||||||
f.precision(4);
|
f.precision(4);
|
||||||
f << R"CODE_(
|
f << R"CODE_(
|
||||||
<head>
|
<head>
|
||||||
<script src="https://d3js.org/d3.v5.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
|
||||||
<script src="https://unpkg.com/sunburst-chart"></script>
|
<script src="https://unpkg.com/sunburst-chart"></script>
|
||||||
|
|
||||||
<style>body { margin: 0 }</style>
|
<style>
|
||||||
|
body { margin: 0 }
|
||||||
|
.tooltip {
|
||||||
|
white-space: pre-line !important;
|
||||||
|
max-width: 800px !important;
|
||||||
|
word-wrap: break-word !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
)CODE_";
|
)CODE_";
|
||||||
if(!time_or_memory)
|
if(!time_or_memory)
|
||||||
f << "<title>Maximum Memory Consumption</title>\n";
|
f << "<title>Maximum Memory Consumption</title>\n";
|
||||||
|
@ -25,6 +25,7 @@ namespace ngcore
|
|||||||
NGCORE_API static bool trace_thread_counter;
|
NGCORE_API static bool trace_thread_counter;
|
||||||
NGCORE_API static bool trace_threads;
|
NGCORE_API static bool trace_threads;
|
||||||
NGCORE_API static bool mem_tracing_enabled;
|
NGCORE_API static bool mem_tracing_enabled;
|
||||||
|
NGCORE_API static bool write_paje_file;
|
||||||
|
|
||||||
bool tracing_enabled;
|
bool tracing_enabled;
|
||||||
TTimePoint start_time;
|
TTimePoint start_time;
|
||||||
@ -32,6 +33,8 @@ namespace ngcore
|
|||||||
size_t n_memory_events_at_start;
|
size_t n_memory_events_at_start;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
NGCORE_API void Write();
|
||||||
|
NGCORE_API void WritePajeFile( const std::string & filename );
|
||||||
NGCORE_API void WriteTimingChart();
|
NGCORE_API void WriteTimingChart();
|
||||||
#ifdef NETGEN_TRACE_MEMORY
|
#ifdef NETGEN_TRACE_MEMORY
|
||||||
NGCORE_API void WriteMemoryChart( std::string fname );
|
NGCORE_API void WriteMemoryChart( std::string fname );
|
||||||
@ -61,6 +64,11 @@ namespace ngcore
|
|||||||
max_tracefile_size = max_size;
|
max_tracefile_size = max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetWritePajeFile( bool write )
|
||||||
|
{
|
||||||
|
write_paje_file = write;
|
||||||
|
}
|
||||||
|
|
||||||
std::string tracefile_name;
|
std::string tracefile_name;
|
||||||
|
|
||||||
struct Job
|
struct Job
|
||||||
@ -262,8 +270,6 @@ namespace ngcore
|
|||||||
links[thread_id].push_back( ThreadLink{thread_id, key, GetTimeCounter(), false} );
|
links[thread_id].push_back( ThreadLink{thread_id, key, GetTimeCounter(), false} );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write( const std::string & filename );
|
|
||||||
|
|
||||||
void SendData(); // MPI parallel data reduction
|
void SendData(); // MPI parallel data reduction
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -36,13 +36,13 @@ namespace netgen
|
|||||||
mesh->SetMaterial(2, "2_points");
|
mesh->SetMaterial(2, "2_points");
|
||||||
mesh->SetMaterial(3, "3_points");
|
mesh->SetMaterial(3, "3_points");
|
||||||
mesh->SetMaterial(4, "4_points");
|
mesh->SetMaterial(4, "4_points");
|
||||||
mesh->Compress();
|
|
||||||
|
|
||||||
mesh->ClearSurfaceElements();
|
mesh->ClearSurfaceElements();
|
||||||
|
|
||||||
for (auto & el : openelements)
|
for (auto & el : openelements)
|
||||||
mesh->AddSurfaceElement( el );
|
mesh->AddSurfaceElement( el );
|
||||||
|
|
||||||
|
mesh->Compress();
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +239,7 @@ double MeshOptimize3d :: CombineImproveEdge (
|
|||||||
{
|
{
|
||||||
Element & elem = mesh[ei];
|
Element & elem = mesh[ei];
|
||||||
if (elem.IsDeleted()) return false;
|
if (elem.IsDeleted()) return false;
|
||||||
|
if(elem.GetType() != TET) return false; // TODO: implement case where pi0 or pi1 is top of a pyramid
|
||||||
|
|
||||||
if (elem[0] == pi0 || elem[1] == pi0 || elem[2] == pi0 || elem[3] == pi0)
|
if (elem[0] == pi0 || elem[1] == pi0 || elem[2] == pi0 || elem[3] == pi0)
|
||||||
{
|
{
|
||||||
@ -1320,7 +1321,7 @@ void MeshOptimize3d :: SwapImprove (const NgBitArray * working_elements)
|
|||||||
for (ElementIndex eli : myrange)
|
for (ElementIndex eli : myrange)
|
||||||
{
|
{
|
||||||
const auto & el = mesh[eli];
|
const auto & el = mesh[eli];
|
||||||
if(el.Flags().fixed)
|
if(el.Flags().fixed || el.GetType() != TET)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(mp.only3D_domain_nr && mp.only3D_domain_nr != el.GetIndex())
|
if(mp.only3D_domain_nr && mp.only3D_domain_nr != el.GetIndex())
|
||||||
@ -2637,6 +2638,7 @@ double MeshOptimize3d :: SplitImprove2Element (
|
|||||||
Element & elem = mesh[ei0];
|
Element & elem = mesh[ei0];
|
||||||
if (elem.IsDeleted()) return false;
|
if (elem.IsDeleted()) return false;
|
||||||
if (ei0 == ei) continue;
|
if (ei0 == ei) continue;
|
||||||
|
if (elem.GetType() != TET) return false;
|
||||||
|
|
||||||
if (elem[0] == pi1 || elem[1] == pi1 || elem[2] == pi1 || elem[3] == pi1 || (elem.GetNP()==5 && elem[4]==pi1) )
|
if (elem[0] == pi1 || elem[1] == pi1 || elem[2] == pi1 || elem[3] == pi1 || (elem.GetNP()==5 && elem[4]==pi1) )
|
||||||
if(!has_both_points0.Contains(ei0))
|
if(!has_both_points0.Contains(ei0))
|
||||||
@ -2648,6 +2650,7 @@ double MeshOptimize3d :: SplitImprove2Element (
|
|||||||
Element & elem = mesh[ei1];
|
Element & elem = mesh[ei1];
|
||||||
if (elem.IsDeleted()) return false;
|
if (elem.IsDeleted()) return false;
|
||||||
if (ei1 == ei) continue;
|
if (ei1 == ei) continue;
|
||||||
|
if (elem.GetType() != TET) return false;
|
||||||
|
|
||||||
if (elem[0] == pi3 || elem[1] == pi3 || elem[2] == pi3 || elem[3] == pi3 || (elem.GetNP()==5 && elem[4]==pi3))
|
if (elem[0] == pi3 || elem[1] == pi3 || elem[2] == pi3 || elem[3] == pi3 || (elem.GetNP()==5 && elem[4]==pi3))
|
||||||
if(!has_both_points1.Contains(ei1))
|
if(!has_both_points1.Contains(ei1))
|
||||||
|
Loading…
Reference in New Issue
Block a user