Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_numerics
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
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
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_numerics
Commits
64e80911
Commit
64e80911
authored
2 years ago
by
Abhinav Singh
Browse files
Options
Downloads
Patches
Plain Diff
Changing Lagrange Multiplier to Componentwise instead of weak sum on all variables
parent
042a535c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/DCPSE/DCPSE_op/DCPSE_Solver.hpp
+44
-51
44 additions, 51 deletions
src/DCPSE/DCPSE_op/DCPSE_Solver.hpp
with
44 additions
and
51 deletions
src/DCPSE/DCPSE_op/DCPSE_Solver.hpp
+
44
−
51
View file @
64e80911
...
...
@@ -118,8 +118,8 @@ class DCPSE_scheme {
}
else
if
(
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
)
{
b
.
resize
(
Sys_eqs
::
nvar
*
tot
+
1
,
Sys_eqs
::
nvar
*
sz
+
1
);
x_ig
.
resize
(
Sys_eqs
::
nvar
*
tot
+
1
,
Sys_eqs
::
nvar
*
sz
+
1
);
b
.
resize
(
Sys_eqs
::
nvar
*
(
tot
+
1
)
,
Sys_eqs
::
nvar
*
(
sz
+
1
)
)
;
x_ig
.
resize
(
Sys_eqs
::
nvar
*
(
tot
+
1
)
,
Sys_eqs
::
nvar
*
(
sz
+
1
)
)
;
}
else
{
b
.
resize
(
Sys_eqs
::
nvar
*
tot
+
1
,
Sys_eqs
::
nvar
*
sz
);
x_ig
.
resize
(
Sys_eqs
::
nvar
*
tot
+
1
,
Sys_eqs
::
nvar
*
sz
);
...
...
@@ -245,8 +245,9 @@ class DCPSE_scheme {
// Indicate all the non zero rows
openfpm
::
vector
<
unsigned
char
>
nz_rows
;
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
&&
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
nz_rows
.
resize
(
row_b
+
1
);
nz_rows
.
resize
(
row_b
+
Sys_eqs
::
nvar
);
}
else
{
nz_rows
.
resize
(
row_b
);
...
...
@@ -266,7 +267,7 @@ class DCPSE_scheme {
if
(
v_cl
.
getProcessingUnits
()
==
1
)
{
openfpm
::
vector
<
unsigned
>
nz_cols
;
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
&&
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
nz_cols
.
resize
(
row_b
+
1
);
nz_cols
.
resize
(
row_b
+
Sys_eqs
::
nvar
);
}
else
{
nz_cols
.
resize
(
row_b
);
...
...
@@ -473,7 +474,7 @@ public:
" properties "
<<
std
::
endl
;
};
#endif
auto
x
=
solver
.
with_
constant_
nullspace_solve
(
getA
(
opt
),
getB
(
opt
));
auto
x
=
solver
.
with_nullspace_solve
(
getA
(
opt
),
getB
(
opt
));
unsigned
int
comp
=
0
;
copy_nested
(
x
,
comp
,
exps
...);
...
...
@@ -756,65 +757,57 @@ public:
p_map
.
size_local
()
*
Sys_eqs
::
nvar
,
p_map
.
size_local
()
*
Sys_eqs
::
nvar
);
}
else
if
(
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
else
if
(
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
){
auto
&
v_cl
=
create_vcluster
();
openfpm
::
vector
<
triplet
>
&
trpl
=
A
.
getMatrixTriplets
();
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
)
{
A
.
resize
(
tot
*
Sys_eqs
::
nvar
+
1
,
tot
*
Sys_eqs
::
nvar
+
1
,
p_map
.
size_local
()
*
Sys_eqs
::
nvar
+
1
,
p_map
.
size_local
()
*
Sys_eqs
::
nvar
+
1
);
for
(
int
i
=
0
;
i
<
tot
*
Sys_eqs
::
nvar
;
i
++
)
{
triplet
t1
;
t1
.
row
()
=
tot
*
Sys_eqs
::
nvar
;
t1
.
col
()
=
i
;
t1
.
value
()
=
1
;
trpl
.
add
(
t1
);
}
A
.
resize
(
Sys_eqs
::
nvar
*
(
tot
+
1
),
Sys_eqs
::
nvar
*
(
tot
+
1
),
Sys_eqs
::
nvar
*
(
p_map
.
size_local
()
+
1
),
Sys_eqs
::
nvar
*
(
p_map
.
size_local
()
+
1
));
for
(
int
j
=
0
;
j
<
Sys_eqs
::
nvar
;
j
++
)
{
for
(
int
i
=
j
*
tot
;
i
<
(
j
+
1
)
*
tot
;
i
++
)
{
triplet
t1
;
t1
.
row
()
=
tot
*
Sys_eqs
::
nvar
+
j
;
t1
.
col
()
=
i
;
t1
.
value
()
=
1
;
trpl
.
add
(
t1
);
}
for
(
int
i
=
0
;
i
<
p_map
.
size_local
()
*
Sys_eqs
::
nvar
;
i
++
)
{
triplet
t2
;
t2
.
row
()
=
i
+
s_pnt
*
Sys_eqs
::
nvar
;
t2
.
col
()
=
tot
*
Sys_eqs
::
nvar
;
t2
.
value
()
=
1
;
trpl
.
add
(
t2
);
if
(
tot
*
j
<=
i
+
s_pnt
*
Sys_eqs
::
nvar
<
tot
*
(
j
+
1
)){
triplet
t2
;
t2
.
row
()
=
i
+
s_pnt
*
Sys_eqs
::
nvar
;
t2
.
col
()
=
tot
*
Sys_eqs
::
nvar
+
j
;
t2
.
value
()
=
1
;
trpl
.
add
(
t2
);
}
}
triplet
t3
;
t3
.
col
()
=
tot
*
Sys_eqs
::
nvar
;
t3
.
row
()
=
tot
*
Sys_eqs
::
nvar
;
t3
.
col
()
=
tot
*
Sys_eqs
::
nvar
+
j
;
t3
.
row
()
=
tot
*
Sys_eqs
::
nvar
+
j
;
t3
.
value
()
=
0
;
trpl
.
add
(
t3
);
}
}
//row_b++;
//row++;
}
else
{
A
.
resize
(
tot
*
Sys_eqs
::
nvar
+
1
,
tot
*
Sys_eqs
::
nvar
+
1
,
A
.
resize
(
Sys_eqs
::
nvar
*
(
tot
+
1
)
,
Sys_eqs
::
nvar
*
(
tot
+
1
)
,
p_map
.
size_local
()
*
Sys_eqs
::
nvar
,
p_map
.
size_local
()
*
Sys_eqs
::
nvar
);
for
(
int
i
=
0
;
i
<
p_map
.
size_local
()
*
Sys_eqs
::
nvar
;
i
++
)
{
triplet
t2
;
t2
.
row
()
=
i
+
s_pnt
*
Sys_eqs
::
nvar
;
t2
.
col
()
=
tot
*
Sys_eqs
::
nvar
;
t2
.
value
()
=
1
;
trpl
.
add
(
t2
);
for
(
int
j
=
0
;
j
<
Sys_eqs
::
nvar
;
j
++
)
{
for
(
int
i
=
p_map
.
size_local
()
*
j
;
i
<
p_map
.
size_local
()
*
j
+
1
;
i
++
)
{
if
(
tot
*
j
<=
i
+
s_pnt
*
Sys_eqs
::
nvar
<
tot
*
(
j
+
1
))
{
triplet
t2
;
t2
.
row
()
=
i
+
s_pnt
*
Sys_eqs
::
nvar
;
t2
.
col
()
=
tot
*
Sys_eqs
::
nvar
+
j
;
t2
.
value
()
=
1
;
trpl
.
add
(
t2
);
}
}
}
}
}
else
{
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
)
{
...
...
@@ -847,8 +840,8 @@ public:
if
(
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
)
{
b
(
tot
*
Sys_eqs
::
nvar
)
=
0
;
for
(
int
j
=
0
;
j
<
Sys_eqs
::
nvar
;
j
++
)
{
b
(
tot
*
Sys_eqs
::
nvar
+
j
)
=
0
;
}
}
}
return
b
;
...
...
@@ -866,8 +859,8 @@ public:
if
(
opt
==
options_solver
::
LAGRANGE_MULTIPLIER
)
{
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
rank
()
==
v_cl
.
size
()
-
1
)
{
x_ig
(
tot
*
Sys_eqs
::
nvar
)
=
0
;
for
(
int
j
=
0
;
j
<
Sys_eqs
::
nvar
;
j
++
)
{
x_ig
(
tot
*
Sys_eqs
::
nvar
+
j
)
=
0
;
}
}
}
return
x_ig
;
...
...
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