Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Multiphysics 0471
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Denis Louis
Multiphysics 0471
Commits
44aa7b79
Commit
44aa7b79
authored
3 years ago
by
Denis Louis
Browse files
Options
Downloads
Patches
Plain Diff
remove all the useless printing
parent
e1300cc0
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Coupling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
srcs/FEM/my_code.cpp
+18
-31
18 additions, 31 deletions
srcs/FEM/my_code.cpp
with
18 additions
and
31 deletions
srcs/FEM/my_code.cpp
+
18
−
31
View file @
44aa7b79
...
...
@@ -740,7 +740,7 @@ int main(int argc, char **argv)
Eigen
::
initParallel
();
double
start
=
omp_get_wtime
();
//
double start = omp_get_wtime();
int
max_threads
=
omp_get_max_threads
();
...
...
@@ -771,14 +771,12 @@ int main(int argc, char **argv)
std
::
vector
<
std
::
size_t
>
FEM_nodeTags
;
std
::
vector
<
double
>
FEM_nodecoord
;
std
::
vector
<
double
>
FEM_nodeparametricCoord
;
std
::
cout
<<
"dim: "
<<
dim
<<
", tag: "
<<
tag
<<
"
\n
"
;
// Getting entities of the domain to fill FEM_nodeTags, en faire une fonction ?
std
::
vector
<
int
>
tags
;
gmsh
::
model
::
getEntitiesForPhysicalGroup
(
dim
,
tag
,
tags
);
std
::
vector
<
std
::
vector
<
std
::
size_t
>>
tmp_nodeTags
(
tags
.
size
());
// will store the nodeTags associated to one given entity of the domain
gmsh
::
model
::
mesh
::
getNodes
(
tmp_nodeTags
[
0
],
FEM_nodecoord
,
FEM_nodeparametricCoord
,
dim
,
tags
[
0
],
true
);
std
::
sort
(
tmp_nodeTags
[
0
].
begin
(),
tmp_nodeTags
[
0
].
end
());
// need to sort the vectors in order to merge them afterwards
std
::
cout
<<
tags
.
size
();
for
(
std
::
size_t
i
=
1
;
i
<
tags
.
size
();
i
++
)
{
// in the case the domain contains multiple entities
gmsh
::
model
::
mesh
::
getNodes
(
tmp_nodeTags
[
i
],
FEM_nodecoord
,
FEM_nodeparametricCoord
,
dim
,
tags
[
i
],
true
);
...
...
@@ -790,26 +788,23 @@ int main(int argc, char **argv)
if
(
tags
.
size
()
==
1
){
// if the domain contains one single entity
FEM_nodeTags
=
tmp_nodeTags
[
0
];
}
std
::
cout
<<
"FEM node tags:
\t
"
;
/*
std::cout << "FEM node tags: \t";
for (std::size_t i = 0; i < FEM_nodeTags.size(); i++)
{
std::cout << FEM_nodeTags[i] << " ";
}
std
::
cout
<<
"
\n
"
;
std::cout << "\n";
*/
/*-------map between nodeTag and index of first nodal displacement associated to the node (second one is the same +1)------*/
std
::
map
<
int
,
int
>
node_map
;
std
::
cout
<<
"node mapping: "
;
for
(
std
::
size_t
i
=
0
;
i
<
FEM_nodeTags
.
size
();
++
i
)
{
int
nodeTag
=
FEM_nodeTags
[
i
];
// use i à la place de nodeTag pour traiter cas ou le nodeTag n'est pas une suite continue
int
node_first_index
=
2
*
i
;
node_map
[
nodeTag
]
=
node_first_index
;
std
::
cout
<<
"<"
<<
nodeTag
<<
","
<<
node_first_index
<<
">, "
;
}
std
::
cout
<<
"
\n
"
;
/*-----------get physical properties of domain----------------------*/
std
::
vector
<
std
::
string
>
keys
;
...
...
@@ -824,8 +819,8 @@ int main(int argc, char **argv)
/*-----------------H matrix involved in stress computation------------------*/
Eigen
::
Matrix
<
double
,
3
,
3
>
H_matrix
=
Compute_H_matrix
(
E
,
nu
);
double
startbis
=
omp_get_wtime
();
std
::
cout
<<
"preliminary: "
<<
startbis
-
start
<<
"
\n
"
;
//
double startbis = omp_get_wtime();
//
std::cout << "preliminary: " << startbis-start << "\n";
/*------------computing K matrix and f vector------------------------*/
// we first consider the K matrix and the volumic part of the f vector
...
...
@@ -845,17 +840,17 @@ int main(int argc, char **argv)
std
::
list
<
Eigen
::
Triplet
<
double
>>
k_tripletList
=
my_k_list
[
0
];
std
::
cout
<<
"number of elements for thread 0: "
<<
my_k_list
[
0
].
size
()
<<
"
\n
"
;
//
std::cout << "number of elements for thread 0: " << my_k_list[0].size() << "\n";
if
(
max_threads
>
1
)
{
for
(
int
i
=
1
;
i
<
max_threads
;
i
++
)
{
std
::
cout
<<
"number of elements for thread "
<<
i
<<
": "
<<
my_k_list
[
i
].
size
()
<<
"
\n
"
;
//
std::cout << "number of elements for thread " << i << ": " << my_k_list[i].size() << "\n";
k_tripletList
.
insert
(
k_tripletList
.
end
(),
my_k_list
[
i
].
begin
(),
my_k_list
[
i
].
end
());
}
}
std
::
cout
<<
k_tripletList
.
size
()
<<
"
\n
"
;
//
std::cout << k_tripletList.size() << "\n";
full_K_matrix
.
setFromTriplets
(
k_tripletList
.
begin
(),
k_tripletList
.
end
());
for
(
int
i
=
0
;
i
<
max_threads
;
i
++
){
std
::
list
<
std
::
pair
<
int
,
double
>>
&
tmp_vector
=
thread_f_vector
[
i
];
...
...
@@ -865,8 +860,8 @@ int main(int argc, char **argv)
}
}
double
start2
=
omp_get_wtime
();
std
::
cout
<<
"time for K assembly: "
<<
start2
-
startbis
<<
"
\n
"
;
//
double start2 = omp_get_wtime();
//
std::cout << "time for K assembly: " << start2-startbis << "\n";
/*-----------------BOUNDARY CONDITIONS------------*/
...
...
@@ -899,8 +894,8 @@ int main(int argc, char **argv)
}
}
double
start3
=
omp_get_wtime
();
std
::
cout
<<
"time for boundary conditions: "
<<
start3
-
start2
<<
"
\n
"
;
//
double start3 = omp_get_wtime();
//
std::cout << "time for boundary conditions: " << start3 - start2 << "\n";
/*------------FILLING THE REDUCED K MATRIX AND F VECTOR--------------*/
//the correction term on the f vector comes from the "FEM" theoretical course (JP Ponthot), Chap2 Slide 38/50
...
...
@@ -925,8 +920,8 @@ int main(int argc, char **argv)
final_reduced_d
=
solver
.
solve
(
final_reduced_f
);
double
start4
=
omp_get_wtime
();
std
::
cout
<<
"time to solve system: "
<<
start4
-
start3
<<
"
\n
"
;
//
double start4 = omp_get_wtime();
//
std::cout << "time to solve system: " << start4 -start3 << "\n";
/*-----------RECONSTRUCTING FULL NODAL VALUES--------------*/
...
...
@@ -954,8 +949,8 @@ int main(int argc, char **argv)
double
Ry
=
0.
;
Reaction_Forces
(
Rx
,
Ry
,
groups
,
node_map
,
nodal_forces
,
keys
);
double
start5
=
omp_get_wtime
();
std
::
cout
<<
"time for rest: "
<<
start5
-
start4
<<
"
\n
"
;
//
double start5 = omp_get_wtime();
//
std::cout << "time for rest: " << start5 - start4 << "\n";
/*--------------PLOTTING AND SAVING NODAL VALUES------------------*/
// loop over the nodes
...
...
@@ -982,17 +977,9 @@ int main(int argc, char **argv)
for
(
std
::
size_t
j
=
0
;
j
<
elementTags
.
size
();
++
j
)
{
nbelems
+=
elementTags
[
j
].
size
();
std
::
cout
<<
"element tags of element type "
<<
elementTypes
[
j
]
<<
": "
;
for
(
std
::
size_t
k
=
0
;
k
<
elementTags
[
j
].
size
();
k
++
)
{
std
::
cout
<<
" "
<<
elementTags
[
j
][
k
];
}
std
::
cout
<<
"
\n
"
;
}
}
std
::
cout
<<
"number of elements: "
<<
nbelems
<<
"
\n
"
;
/*-------------------ELEMENTAL-NODAL VALUES-----------------------*/
// éventuellement faire un tableau ici qui regroupe tout le bazar pour ne pas avoir la même ligne 7 fois ...
...
...
@@ -1071,8 +1058,8 @@ int main(int argc, char **argv)
gmsh
::
option
::
setNumber
(
my_string
,
0
);
}
double
start6
=
omp_get_wtime
();
std
::
cout
<<
"time for saving results: "
<<
start6
-
start5
<<
"
\n
"
;
//
double start6 = omp_get_wtime();
//
std::cout << "time for saving results: " << start6 - start5 << "\n";
...
...
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