Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ddm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gmsh
ddm
Commits
a17e3755
Commit
a17e3755
authored
1 year ago
by
Boris Martin
Browse files
Options
Downloads
Patches
Plain Diff
refactor de(activate)bilinear
parent
2be1363e
No related branches found
No related tags found
1 merge request
!45
Matrix-matrix product, parallel matrix export
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/problem/Formulation.cpp
+40
-63
40 additions, 63 deletions
src/problem/Formulation.cpp
src/problem/Formulation.h
+3
-0
3 additions, 0 deletions
src/problem/Formulation.h
with
43 additions
and
63 deletions
src/problem/Formulation.cpp
+
40
−
63
View file @
a17e3755
...
...
@@ -1031,35 +1031,6 @@ namespace gmshddm
_artificialCommutator
=
true
;
togglePhysicalAndArtificialSourceTerms
();
auto
deactivateBilinear
=
[
=
](
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
deactivate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
deactivate
();
}
}
}
};
auto
activateBilinear
=
[
=
](
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
activate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
activate
();
}
}
}
};
// Assemble the volumic systems for each subdomain
for
(
auto
idom
=
0ULL
;
idom
<
_volume
.
size
();
++
idom
)
{
...
...
@@ -1068,7 +1039,7 @@ namespace gmshddm
_volume
[
idom
]
->
setAttribute
(
"ddm::artificialCommutator"
,
_artificialCommutator
);
gmshfem
::
common
::
Options
::
instance
()
->
verbose
=
innerVerbosity
;
if
(
sameMatrixWithArtificialAndPhysicalSources
)
{
deactivateBilinear
(
idom
);
_
deactivateBilinear
(
idom
);
_volume
[
idom
]
->
setRHSToZero
();
_volume
[
idom
]
->
assemble
();
}
...
...
@@ -1077,7 +1048,7 @@ namespace gmshddm
_volume
[
idom
]
->
initSystem
();
_volume
[
idom
]
->
pre
();
_volume
[
idom
]
->
assemble
();
deactivateBilinear
(
idom
);
_
deactivateBilinear
(
idom
);
}
gmshfem
::
common
::
Options
::
instance
()
->
verbose
=
outerVerbosity
;
}
...
...
@@ -1125,12 +1096,12 @@ namespace gmshddm
if
(
mpi
::
isItMySubdomain
(
idom
))
{
gmshfem
::
common
::
Options
::
instance
()
->
verbose
=
innerVerbosity
;
if
(
!
sameMatrixWithArtificialAndPhysicalSources
)
{
activateBilinear
(
idom
);
_
activateBilinear
(
idom
);
}
_volume
[
idom
]
->
assemble
();
_volume
[
idom
]
->
solve
(
true
);
if
(
sameMatrixWithArtificialAndPhysicalSources
)
{
activateBilinear
(
idom
);
_
activateBilinear
(
idom
);
}
gmshfem
::
common
::
Options
::
instance
()
->
verbose
=
outerVerbosity
;
}
...
...
@@ -1175,35 +1146,7 @@ namespace gmshddm
_artificialCommutator
=
true
;
togglePhysicalAndArtificialSourceTerms
();
auto
deactivateBilinear
=
[
=
](
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
deactivate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
deactivate
();
}
}
}
};
auto
activateBilinear
=
[
=
](
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
activate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
activate
();
}
}
}
};
for
(
auto
idom
=
0ULL
;
idom
<
_volume
.
size
();
++
idom
)
{
_volume
[
idom
]
->
setAttribute
(
"ddm::physicalCommutator"
,
_physicalCommutator
);
...
...
@@ -1213,7 +1156,7 @@ namespace gmshddm
_volume
[
idom
]
->
initSystem
();
_volume
[
idom
]
->
pre
();
_volume
[
idom
]
->
assemble
();
deactivateBilinear
(
idom
);
_
deactivateBilinear
(
idom
);
gmshfem
::
common
::
Options
::
instance
()
->
verbose
=
outerVerbosity
;
}
...
...
@@ -1250,7 +1193,7 @@ namespace gmshddm
}
for
(
auto
idom
=
0ULL
;
idom
<
_volume
.
size
();
++
idom
)
{
activateBilinear
(
idom
);
_
activateBilinear
(
idom
);
}
...
...
@@ -1415,6 +1358,40 @@ namespace gmshddm
}
}
template
<
class
T_Scalar
>
void
Formulation
<
T_Scalar
>::
_activateBilinear
(
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
activate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
activate
();
}
}
}
}
template
<
class
T_Scalar
>
void
Formulation
<
T_Scalar
>::
_deactivateBilinear
(
const
unsigned
long
long
idom
)
{
for
(
auto
formulation
:
*
_volume
[
idom
])
{
if
(
formulation
->
isBilinear
())
{
formulation
->
deactivate
();
}
}
for
(
auto
formulation
:
_surface
[
idom
])
{
for
(
auto
term
:
*
formulation
.
second
)
{
if
(
term
->
isBilinear
())
{
term
->
deactivate
();
}
}
}
}
template
<
class
T_Scalar
>
int
MatVectProductImpl
(
Mat
A
,
Vec
X
,
Vec
Y
,
bool
IA
)
...
...
This diff is collapsed.
Click to expand it.
src/problem/Formulation.h
+
3
−
0
View file @
a17e3755
...
...
@@ -79,6 +79,9 @@ namespace gmshddm
void
_assembleAndSolveSurface
();
void
_extractRHS
();
void
_activateBilinear
(
const
unsigned
long
long
idom
);
void
_deactivateBilinear
(
const
unsigned
long
long
idom
);
public
:
Formulation
(
const
std
::
string
&
name
,
const
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
&
topology
);
Formulation
(
const
std
::
string
&
name
,
const
std
::
vector
<
gmshfem
::
problem
::
Formulation
<
T_Scalar
>
*
>
&
volume
,
const
std
::
vector
<
std
::
unordered_map
<
unsigned
int
,
gmshfem
::
problem
::
Formulation
<
T_Scalar
>
*
>
>
&
surface
);
...
...
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