v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MoFEM::PipelineGraph Struct Reference

#include "src/interfaces/PipelineGraph.hpp"

Inheritance diagram for MoFEM::PipelineGraph:
[legend]
Collaboration diagram for MoFEM::PipelineGraph:
[legend]

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type-safe casting.
 
 PipelineGraph (const MoFEM::Core &core)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 

Static Public Member Functions

static MoFEMErrorCode writeGraphGraphviz (std::string filename, std::string pip_name, const boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip)
 Pipeline graph to Graphviz file.
 
static MoFEMErrorCode writeKSPGraphGraphviz (KspCtx *ksp_ctx, std::string filename)
 KSP graph to Graphviz file.
 
static MoFEMErrorCode writeSNESGraphGraphviz (SnesCtx *snes_ctx, std::string file_name)
 SNES graph to Graphviz file.
 
static MoFEMErrorCode writeTSGraphGraphviz (TsCtx *ts_ctx, std::string file_name)
 TS graph to Graphviz file.
 
static MoFEMErrorCode writePiplineManagerGraphGraphviz (std::string filename, PipelineManager *pip_mng)
 Write pipeline manager graph to Graphviz file.
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 

Private Attributes

MoFEM::CorecOre
 Reference to MoFEM core instance.
 

Detailed Description

Definition at line 16 of file PipelineGraph.hpp.

Constructor & Destructor Documentation

◆ PipelineGraph()

MoFEM::PipelineGraph::PipelineGraph ( const MoFEM::Core core)

Definition at line 388 of file PipelineGraph.cpp.

389 : cOre(const_cast<Core &>(core)) {}
CoreTmp< 0 > Core
Definition Core.hpp:1154
MoFEM::Core & cOre
Reference to MoFEM core instance.

Member Function Documentation

◆ query_interface()

MoFEMErrorCode MoFEM::PipelineGraph::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Query interface for type-safe casting.

Parameters
type_indexType index of the requested interface
ifacePointer to interface pointer to be set
Returns
MoFEMErrorCode Error code (0 on success)

Implements MoFEM::UnknownInterface.

Definition at line 382 of file PipelineGraph.cpp.

383 {
384 *iface = const_cast<PipelineGraph *>(this);
385 return 0;
386}
PipelineGraph(const MoFEM::Core &core)

◆ writeGraphGraphviz()

MoFEMErrorCode MoFEM::PipelineGraph::writeGraphGraphviz ( std::string  filename,
std::string  pip_name,
const boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip 
)
static

Pipeline graph to Graphviz file.

Parameters
filename
pip_name
pip
Returns
MoFEMErrorCode

Definition at line 146 of file PipelineGraph.cpp.

148 {
150 boost::shared_ptr<Graph> g_ptr(new Graph());
151 auto vname = get(boost::vertex_name, *g_ptr);
152 auto root_vertex = boost::add_vertex(*g_ptr);
153 vname[root_vertex] = {"Finite Element Pipeline Graph", "ellipse", "solid",
154 "black"};
155 plot_pipeline_graph_impl(pip, pip_name, g_ptr, root_vertex);
156 write_graphviz_impl(file_name, g_ptr);
158};
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property< boost::vertex_name_t, VertexData >, boost::property< boost::edge_name_t, std::string > > Graph
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
static void write_graphviz_impl(std::string file_name, boost::shared_ptr< Graph > g_ptr)
static VertexDescriptor plot_pipeline_graph_impl(const boost::ptr_deque< UserDataOperator > &pip, std::string pip_name, boost::shared_ptr< Graph > g_ptr, VertexDescriptor root_vertex)

◆ writeKSPGraphGraphviz()

MoFEMErrorCode MoFEM::PipelineGraph::writeKSPGraphGraphviz ( KspCtx ksp_ctx,
std::string  filename 
)
static

KSP graph to Graphviz file.

Parameters
ts
filename
Returns
MoFEMErrorCode

Definition at line 211 of file PipelineGraph.cpp.

212 {
214 boost::shared_ptr<Graph> g_ptr(new Graph());
215 auto &g = *g_ptr;
216
217 auto vname = get(boost::vertex_name, g);
218
219 auto root_vertex = boost::add_vertex(g);
220 vname[root_vertex] = {"KSP Graph", "ellipse", "solid", "black"};
221
222 auto lhs_vertex = boost::add_vertex(g);
223 vname[lhs_vertex] = {"Lhs", "box3d", "filled", "lightgrey"};
224 add_edge(root_vertex, lhs_vertex, g);
225 add_stages(ksp_ctx->getPreProcSetOperators(), ksp_ctx->getSetOperators(),
226 ksp_ctx->getPostProcSetOperators(), lhs_vertex, g_ptr);
227
228 auto rhs_vertex = boost::add_vertex(g);
229 vname[rhs_vertex] = {"Rhs", "box3d", "filled", "lightgrey"};
230 add_edge(root_vertex, rhs_vertex, g);
231 add_stages(ksp_ctx->getPreProcComputeRhs(), ksp_ctx->getComputeRhs(),
232 ksp_ctx->getPostProcComputeRhs(), rhs_vertex, g_ptr);
233
234 write_graphviz_impl(file_name, g_ptr);
236}
static void add_stages(BasicMethodsSequence &pre, FEMethodsSequence &op, BasicMethodsSequence &post, VertexDescriptor start_vertex, boost::shared_ptr< Graph > g_ptr)
constexpr double g

◆ writePiplineManagerGraphGraphviz()

MoFEMErrorCode MoFEM::PipelineGraph::writePiplineManagerGraphGraphviz ( std::string  filename,
PipelineManager pip_mng 
)
static

Write pipeline manager graph to Graphviz file.

Parameters
filename
Returns
MoFEMErrorCode

Definition at line 320 of file PipelineGraph.cpp.

321 {
323 boost::shared_ptr<Graph> g_ptr(new Graph());
324 auto vname = get(boost::vertex_name, *g_ptr);
325 auto root_vertex = boost::add_vertex(*g_ptr);
326 vname[root_vertex] = {"Pipeline Manager Graph", "ellipse", "solid", "black"};
327
328 // lhs
329 if (pip_mng->getDomainLhsFE())
330 plot_pipeline_graph_impl(pip_mng->getOpDomainLhsPipeline(),
331 "DomainLhsPipeline", g_ptr, root_vertex);
332 if (pip_mng->getBoundaryLhsFE())
333 plot_pipeline_graph_impl(pip_mng->getOpBoundaryLhsPipeline(),
334 "BoundaryLhsPipeline", g_ptr, root_vertex);
335 if (pip_mng->getSkeletonLhsFE())
336 plot_pipeline_graph_impl(pip_mng->getOpSkeletonLhsPipeline(),
337 "SkeletonLhsPipeline", g_ptr, root_vertex);
338
339 // rhs
340 if (pip_mng->getDomainRhsFE())
341 plot_pipeline_graph_impl(pip_mng->getOpDomainRhsPipeline(),
342 "DomainRhsPipeline", g_ptr, root_vertex);
343 if (pip_mng->getBoundaryRhsFE())
344 plot_pipeline_graph_impl(pip_mng->getOpBoundaryRhsPipeline(),
345 "BoundaryRhsPipeline", g_ptr, root_vertex);
346
347 if (pip_mng->getSkeletonRhsFE())
348 plot_pipeline_graph_impl(pip_mng->getOpSkeletonRhsPipeline(),
349 "SkeletonRhsPipeline", g_ptr, root_vertex);
350 // rhs explict
351 if (pip_mng->getDomainExplicitRhsFE())
352 plot_pipeline_graph_impl(pip_mng->getOpDomainExplicitRhsPipeline(),
353 "DomainRhsExplicitPipeline", g_ptr,
354 root_vertex);
355 if (pip_mng->getBoundaryExplicitRhsFE())
356 plot_pipeline_graph_impl(pip_mng->getOpBoundaryExplicitRhsPipeline(),
357 "BoundaryRhsExplicitPipeline", g_ptr,
358 root_vertex);
359 if (pip_mng->getSkeletonExplicitRhsFE())
360 plot_pipeline_graph_impl(pip_mng->getOpSkeletonExplicitRhsPipeline(),
361 "SkeletonRhsExplicitPipeline", g_ptr,
362 root_vertex);
363
364 // meshset
365 if (pip_mng->getMeshsetLhsFE())
366 plot_pipeline_graph_impl(pip_mng->getOpMeshsetLhsPipeline(),
367 "MeshsetLhsPipeline", g_ptr, root_vertex);
368 if (pip_mng->getMeshsetRhsFE())
369 plot_pipeline_graph_impl(pip_mng->getOpMeshsetRhsPipeline(),
370 "MeshsetRhsPipeline", g_ptr, root_vertex);
371 if (pip_mng->getMeshsetExplicitRhsFE())
372 plot_pipeline_graph_impl(pip_mng->getOpMeshsetExplicitRhsPipeline(),
373 "MeshsetRhsExplicitPipeline", g_ptr,
374 root_vertex);
375
376 write_graphviz_impl(file_name, g_ptr);
377
379}

◆ writeSNESGraphGraphviz()

MoFEMErrorCode MoFEM::PipelineGraph::writeSNESGraphGraphviz ( SnesCtx snes_ctx,
std::string  file_name 
)
static

SNES graph to Graphviz file.

Parameters
snes_ctx
file_name
Returns
MoFEMErrorCode

Definition at line 239 of file PipelineGraph.cpp.

240 {
242 boost::shared_ptr<Graph> g_ptr(new Graph());
243 auto &g = *g_ptr;
244
245 auto vname = get(boost::vertex_name, g);
246
247 auto root_vertex = boost::add_vertex(g);
248 vname[root_vertex] = {"SNES Graph", "ellipse", "solid", "black"};
249
250 auto lhs_vertex = boost::add_vertex(g);
251 vname[lhs_vertex] = {"Lhs", "box3d", "filled", "lightgrey"};
252 add_edge(root_vertex, lhs_vertex, g);
253 add_stages(snes_ctx->getPreProcSetOperators(), snes_ctx->getSetOperators(),
254 snes_ctx->getPostProcSetOperators(), lhs_vertex, g_ptr);
255
256 auto rhs_vertex = boost::add_vertex(g);
257 vname[rhs_vertex] = {"Rhs", "box3d", "filled", "lightgrey"};
258 add_edge(root_vertex, rhs_vertex, g);
259 add_stages(snes_ctx->getPreProcComputeRhs(), snes_ctx->getComputeRhs(),
260 snes_ctx->getPostProcComputeRhs(), rhs_vertex, g_ptr);
261
262 auto load_vertex = boost::add_vertex(g);
263 vname[load_vertex] = {"LoadTangent", "box3d", "filled", "lightgrey"};
264 add_edge(root_vertex, load_vertex, g);
265 add_stages(snes_ctx->getPreProcLoadTangent(), snes_ctx->getLoadTangent(),
266 snes_ctx->getPostProcLoadTangent(), load_vertex, g_ptr);
267
268 write_graphviz_impl(file_name, g_ptr);
269
271}

◆ writeTSGraphGraphviz()

MoFEMErrorCode MoFEM::PipelineGraph::writeTSGraphGraphviz ( TsCtx ts_ctx,
std::string  file_name 
)
static

TS graph to Graphviz file.

Parameters
snes_ctx
file_name
Returns
MoFEMErrorCode

Definition at line 274 of file PipelineGraph.cpp.

275 {
277 boost::shared_ptr<Graph> g_ptr(new Graph());
278 auto &g = *g_ptr;
279
280 auto vname = get(boost::vertex_name, g);
281
282 auto root_vertex = boost::add_vertex(g);
283 vname[root_vertex] = {"TS Graph", "ellipse", "solid", "black"};
284
285 auto ifunction_vertex = boost::add_vertex(g);
286 vname[ifunction_vertex] = {"IFunction", "box3d", "filled", "lightgrey"};
287 add_edge(root_vertex, ifunction_vertex, g);
289 ts_ctx->getPostProcessIFunction(), ifunction_vertex, g_ptr);
290
291 auto rhsfunction_vertex = boost::add_vertex(g);
292 vname[rhsfunction_vertex] = {"RHSFunction", "box3d", "filled", "lightgrey"};
293 add_edge(root_vertex, rhsfunction_vertex, g);
295 ts_ctx->getPostProcessRHSFunction(), rhsfunction_vertex, g_ptr);
296
297 auto ijjacobian_vertex = boost::add_vertex(g);
298 vname[ijjacobian_vertex] = {"IJacobian", "box3d", "filled", "lightgrey"};
299 add_edge(root_vertex, ijjacobian_vertex, g);
301 ts_ctx->getPostProcessIJacobian(), ijjacobian_vertex, g_ptr);
302
303 auto rhsjacobian_vertex = boost::add_vertex(g);
304 vname[rhsjacobian_vertex] = {"RHSJacobian", "box3d", "filled", "lightgrey"};
305 add_edge(root_vertex, rhsjacobian_vertex, g);
307 ts_ctx->getPostProcessRHSJacobian(), rhsjacobian_vertex, g_ptr);
308
309 auto monitor_vertex = boost::add_vertex(g);
310 vname[monitor_vertex] = {"Monitor", "box3d", "filled", "lightgrey"};
311 add_edge(root_vertex, monitor_vertex, g);
313 ts_ctx->getPostProcessMonitor(), monitor_vertex, g_ptr);
314
315 write_graphviz_impl(file_name, g_ptr);
317}
MoFEM::TsCtx * ts_ctx
BasicMethodsSequence & getPostProcessRHSFunction()
Get the postProcess to do RHSFunction object.
Definition TsCtx.hpp:182
BasicMethodsSequence & getPostProcessIJacobian()
Get the postProcess to do IJacobian object.
Definition TsCtx.hpp:132
FEMethodsSequence & getLoopsMonitor()
Get the loops to do Monitor object.
Definition TsCtx.hpp:102
BasicMethodsSequence & getPreProcessMonitor()
Get the preProcess to do Monitor object.
Definition TsCtx.hpp:141
BasicMethodsSequence & getPostProcessRHSJacobian()
Get the postProcess to do RHSJacobian object.
Definition TsCtx.hpp:164
BasicMethodsSequence & getPostProcessIFunction()
Get the postProcess to do IFunction object.
Definition TsCtx.hpp:116
BasicMethodsSequence & getPreProcessRHSFunction()
Get the preProcess to do RHSFunction object.
Definition TsCtx.hpp:173
FEMethodsSequence & getLoopsIFunction()
Get the loops to do IFunction object.
Definition TsCtx.hpp:63
FEMethodsSequence & getLoopsRHSJacobian()
Get the loops to do RHSJacobian object.
Definition TsCtx.hpp:93
BasicMethodsSequence & getPreProcessIFunction()
Get the preProcess to do IFunction object.
Definition TsCtx.hpp:109
FEMethodsSequence & getLoopsRHSFunction()
Get the loops to do RHSFunction object.
Definition TsCtx.hpp:73
FEMethodsSequence & getLoopsIJacobian()
Get the loops to do IJacobian object.
Definition TsCtx.hpp:83
BasicMethodsSequence & getPreProcessRHSJacobian()
Get the preProcess to do RHSJacobian object.
Definition TsCtx.hpp:155
BasicMethodsSequence & getPostProcessMonitor()
Get the postProcess to do Monitor object.
Definition TsCtx.hpp:148
BasicMethodsSequence & getPreProcessIJacobian()
Get the preProcess to do IJacobian object.
Definition TsCtx.hpp:125

Member Data Documentation

◆ cOre

MoFEM::Core& MoFEM::PipelineGraph::cOre
private

Reference to MoFEM core instance.

Definition at line 82 of file PipelineGraph.hpp.


The documentation for this struct was generated from the following files: