Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-uggrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
staging
dune-uggrid
Commits
21e66548
Commit
21e66548
authored
7 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Patches
Plain Diff
DDD: add state of prio to context object
parent
f0473d60
No related branches found
No related tags found
1 merge request
!96
DDD: move global state to a context object
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/uggrid/parallel/ddd/dddcontext.hh
+16
-0
16 additions, 0 deletions
dune/uggrid/parallel/ddd/dddcontext.hh
dune/uggrid/parallel/ddd/dddtypes.hh
+6
-0
6 additions, 0 deletions
dune/uggrid/parallel/ddd/dddtypes.hh
parallel/ddd/prio/pcmds.cc
+15
-58
15 additions, 58 deletions
parallel/ddd/prio/pcmds.cc
with
37 additions
and
58 deletions
dune/uggrid/parallel/ddd/dddcontext.hh
+
16
−
0
View file @
21e66548
...
...
@@ -51,6 +51,15 @@ struct ObjmgrContext
}
/* namespace Mgr */
namespace
Prio
{
struct
PrioContext
{
PrioMode
prioMode
;
};
}
/* namespace Prio */
class
DDDContext
{
public:
DDDContext
(
const
std
::
shared_ptr
<
PPIF
::
PPIFContext
>&
ppifContext
);
...
...
@@ -106,6 +115,12 @@ public:
Mgr
::
ObjmgrContext
&
objmgrContext
()
{
return
objmgrContext_
;
}
Prio
::
PrioContext
&
prioContext
()
{
return
prioContext_
;
}
const
Prio
::
PrioContext
&
prioContext
()
const
{
return
prioContext_
;
}
protected
:
std
::
shared_ptr
<
PPIF
::
PPIFContext
>
ppifContext_
;
void
*
data_
=
nullptr
;
...
...
@@ -113,6 +128,7 @@ protected:
Basic
::
NotifyContext
notifyContext_
;
Basic
::
TopoContext
topoContext_
;
Mgr
::
ObjmgrContext
objmgrContext_
;
Prio
::
PrioContext
prioContext_
;
};
}
/* namespace DDD */
...
...
This diff is collapsed.
Click to expand it.
dune/uggrid/parallel/ddd/dddtypes.hh
+
6
−
0
View file @
21e66548
...
...
@@ -33,6 +33,12 @@ struct NOTIFY_INFO;
}
/* namespace Basic */
namespace
Prio
{
enum
class
PrioMode
:
unsigned
char
;
}
/* namespace Prio */
}
/* namespace DDD */
#endif
This diff is collapsed.
Click to expand it.
parallel/ddd/prio/pcmds.cc
+
15
−
58
View file @
21e66548
...
...
@@ -38,8 +38,6 @@
#include
"dddi.h"
START_UGDIM_NAMESPACE
#define DebugPrio 10
/* 0 is all, 10 is off */
...
...
@@ -54,6 +52,9 @@ START_UGDIM_NAMESPACE
/****************************************************************************/
namespace
DDD
{
namespace
Prio
{
/* overall mode of prio-environment */
enum
class
PrioMode
:
unsigned
char
{
PMODE_IDLE
=
0
,
/* waiting for next DDD_PrioBegin() */
...
...
@@ -61,58 +62,12 @@ enum class PrioMode : unsigned char {
PMODE_BUSY
/* during DDD_PrioEnd() */
};
}
/* namespace Prio */
}
/* namespace DDD */
START_UGDIM_NAMESPACE
/****************************************************************************/
/* */
/* data structures */
/* */
/****************************************************************************/
/****************************************************************************/
/* PRIO_GLOBALS: global data for prio module */
/****************************************************************************/
struct
PRIO_GLOBALS
{
/* mode of prio module */
PrioMode
prioMode
;
};
/****************************************************************************/
/* */
/* definition of exported global variables */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* definition of variables global to this source file only (static!) */
/* */
/****************************************************************************/
/* one instance of PRIO_GLOBALS */
static
PRIO_GLOBALS
prioGlobals
;
/****************************************************************************/
/* */
/* routines */
/* */
/****************************************************************************/
using
DDD
::
Prio
::
PrioMode
;
/*
management functions for PrioMode.
...
...
@@ -137,11 +92,12 @@ static const char* PrioModeName (PrioMode mode)
static
void
PrioSetMode
(
DDD
::
DDDContext
&
context
,
PrioMode
mode
)
{
prioGlobals
.
prioMode
=
mode
;
auto
&
ctx
=
context
.
prioContext
();
ctx
.
prioMode
=
mode
;
# if DebugPrio<=8
sprintf
(
cBuffer
,
"%4d: PrioMode=%s.
\n
"
,
me
,
PrioModeName
(
prioGlobals
.
prioMode
));
me
,
PrioModeName
(
ctx
.
prioMode
));
DDD_PrintDebug
(
cBuffer
);
# endif
}
...
...
@@ -161,21 +117,22 @@ static PrioMode PrioSuccMode (PrioMode mode)
bool
ddd_PrioActive
(
const
DDD
::
DDDContext
&
context
)
{
return
prioGlobals
.
prioMode
!=
PrioMode
::
PMODE_IDLE
;
return
context
.
prioContext
()
.
prioMode
!=
PrioMode
::
PMODE_IDLE
;
}
static
bool
PrioStepMode
(
DDD
::
DDDContext
&
context
,
PrioMode
old
)
{
if
(
prioGlobals
.
prioMode
!=
old
)
auto
&
ctx
=
context
.
prioContext
();
if
(
ctx
.
prioMode
!=
old
)
{
sprintf
(
cBuffer
,
"wrong prio-mode (currently in %s, expected %s)"
,
PrioModeName
(
prioGlobals
.
prioMode
),
PrioModeName
(
old
));
PrioModeName
(
ctx
.
prioMode
),
PrioModeName
(
old
));
DDD_PrintError
(
'E'
,
8200
,
cBuffer
);
return
false
;
}
PrioSetMode
(
context
,
PrioSuccMode
(
prioGlobals
.
prioMode
));
PrioSetMode
(
context
,
PrioSuccMode
(
ctx
.
prioMode
));
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment