Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Larry Price
gmsh
Commits
a4bf0b0d
Commit
a4bf0b0d
authored
13 years ago
by
Matti Pellika
Browse files
Options
Downloads
Patches
Plain Diff
Not not prepare to restore cell complex if not necessary.
parent
0ba0fc79
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
Geo/CellComplex.cpp
+18
-8
18 additions, 8 deletions
Geo/CellComplex.cpp
Geo/CellComplex.h
+30
-29
30 additions, 29 deletions
Geo/CellComplex.h
Geo/GModel.cpp
+2
-1
2 additions, 1 deletion
Geo/GModel.cpp
Geo/Homology.cpp
+6
-3
6 additions, 3 deletions
Geo/Homology.cpp
Geo/Homology.h
+3
-1
3 additions, 1 deletion
Geo/Homology.h
with
59 additions
and
42 deletions
Geo/CellComplex.cpp
+
18
−
8
View file @
a4bf0b0d
...
@@ -10,8 +10,9 @@
...
@@ -10,8 +10,9 @@
CellComplex
::
CellComplex
(
GModel
*
model
,
CellComplex
::
CellComplex
(
GModel
*
model
,
std
::
vector
<
MElement
*>&
domainElements
,
std
::
vector
<
MElement
*>&
domainElements
,
std
::
vector
<
MElement
*>&
subdomainElements
)
:
std
::
vector
<
MElement
*>&
subdomainElements
,
_model
(
model
),
_dim
(
0
),
_simplicial
(
true
),
_saveorig
(
true
)
bool
saveOriginalComplex
)
:
_model
(
model
),
_dim
(
0
),
_simplicial
(
true
),
_saveorig
(
saveOriginalComplex
)
{
{
_insertCells
(
subdomainElements
,
1
);
_insertCells
(
subdomainElements
,
1
);
...
@@ -20,7 +21,7 @@ CellComplex::CellComplex(GModel* model,
...
@@ -20,7 +21,7 @@ CellComplex::CellComplex(GModel* model,
int
num
=
0
;
int
num
=
0
;
for
(
int
dim
=
0
;
dim
<
4
;
dim
++
){
for
(
int
dim
=
0
;
dim
<
4
;
dim
++
){
if
(
getSize
(
dim
)
!=
0
)
_dim
=
dim
;
if
(
getSize
(
dim
)
!=
0
)
_dim
=
dim
;
_ocells
[
dim
]
=
_cells
[
dim
];
if
(
_saveorig
)
_ocells
[
dim
]
=
_cells
[
dim
];
for
(
citer
cit
=
firstCell
(
dim
);
cit
!=
lastCell
(
dim
);
cit
++
){
for
(
citer
cit
=
firstCell
(
dim
);
cit
!=
lastCell
(
dim
);
cit
++
){
Cell
*
cell
=
*
cit
;
Cell
*
cell
=
*
cit
;
cell
->
setNum
(
++
num
);
cell
->
setNum
(
++
num
);
...
@@ -71,11 +72,19 @@ bool CellComplex::_insertCells(std::vector<MElement*>& elements,
...
@@ -71,11 +72,19 @@ bool CellComplex::_insertCells(std::vector<MElement*>& elements,
CellComplex
::~
CellComplex
()
CellComplex
::~
CellComplex
()
{
{
for
(
int
i
=
0
;
i
<
4
;
i
++
){
for
(
int
i
=
0
;
i
<
4
;
i
++
){
if
(
_saveorig
)
{
for
(
citer
cit
=
_ocells
[
i
].
begin
();
cit
!=
_ocells
[
i
].
end
();
cit
++
){
for
(
citer
cit
=
_ocells
[
i
].
begin
();
cit
!=
_ocells
[
i
].
end
();
cit
++
){
Cell
*
cell
=
*
cit
;
Cell
*
cell
=
*
cit
;
delete
cell
;
delete
cell
;
}
}
}
}
else
{
for
(
citer
cit
=
_cells
[
i
].
begin
();
cit
!=
_cells
[
i
].
end
();
cit
++
){
Cell
*
cell
=
*
cit
;
delete
cell
;
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
_newcells
.
size
();
i
++
)
delete
_newcells
.
at
(
i
);
for
(
unsigned
int
i
=
0
;
i
<
_newcells
.
size
();
i
++
)
delete
_newcells
.
at
(
i
);
for
(
unsigned
int
i
=
0
;
i
<
_removedcells
.
size
();
i
++
)
delete
_removedcells
.
at
(
i
);
for
(
unsigned
int
i
=
0
;
i
<
_removedcells
.
size
();
i
++
)
delete
_removedcells
.
at
(
i
);
}
}
...
@@ -94,7 +103,7 @@ void CellComplex::insertCell(Cell* cell)
...
@@ -94,7 +103,7 @@ void CellComplex::insertCell(Cell* cell)
void
CellComplex
::
removeCell
(
Cell
*
cell
,
bool
other
)
void
CellComplex
::
removeCell
(
Cell
*
cell
,
bool
other
)
{
{
if
(
!
hasCell
(
cell
))
return
;
//
if(!hasCell(cell)) return;
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
coboundary
;
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
coboundary
;
cell
->
getCoboundary
(
coboundary
);
cell
->
getCoboundary
(
coboundary
);
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
boundary
;
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
boundary
;
...
@@ -120,7 +129,8 @@ void CellComplex::removeCell(Cell* cell, bool other)
...
@@ -120,7 +129,8 @@ void CellComplex::removeCell(Cell* cell, bool other)
bdCell->removeCoboundaryCell(cell, false);
bdCell->removeCoboundaryCell(cell, false);
}*/
}*/
_cells
[
cell
->
getDim
()].
erase
(
cell
);
int
erased
=
_cells
[
cell
->
getDim
()].
erase
(
cell
);
if
(
!
erased
)
Msg
::
Debug
(
"Tried to remove a cell from the cell complex
\n
"
);
if
(
!
_saveorig
&&
!
cell
->
isCombined
())
_removedcells
.
push_back
(
cell
);
if
(
!
_saveorig
&&
!
cell
->
isCombined
())
_removedcells
.
push_back
(
cell
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Geo/CellComplex.h
+
30
−
29
View file @
a4bf0b0d
...
@@ -60,7 +60,8 @@ class CellComplex
...
@@ -60,7 +60,8 @@ class CellComplex
public:
public:
CellComplex
(
GModel
*
model
,
CellComplex
(
GModel
*
model
,
std
::
vector
<
MElement
*>&
domainElements
,
std
::
vector
<
MElement
*>&
domainElements
,
std
::
vector
<
MElement
*>&
subdomainElements
);
std
::
vector
<
MElement
*>&
subdomainElements
,
bool
saveOriginalComplex
=
true
);
~
CellComplex
();
~
CellComplex
();
...
...
This diff is collapsed.
Click to expand it.
Geo/GModel.cpp
+
2
−
1
View file @
a4bf0b0d
...
@@ -2762,8 +2762,9 @@ void GModel::computeHomology()
...
@@ -2762,8 +2762,9 @@ void GModel::computeHomology()
std
::
pair
<
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
,
std
::
pair
<
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
,
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
>
itp
=
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
>
itp
=
_homologyRequests
.
equal_range
(
*
it
);
_homologyRequests
.
equal_range
(
*
it
);
bool
prepareToRestore
=
(
itp
.
first
!=
itp
.
second
);
Homology
*
homology
=
new
Homology
(
this
,
itp
.
first
->
first
.
first
,
Homology
*
homology
=
new
Homology
(
this
,
itp
.
first
->
first
.
first
,
itp
.
first
->
first
.
second
,
false
);
itp
.
first
->
first
.
second
,
false
,
prepareToRestore
);
CellComplex
*
cellcomplex
=
homology
->
createCellComplex
();
CellComplex
*
cellcomplex
=
homology
->
createCellComplex
();
if
(
cellcomplex
->
getSize
(
0
)){
if
(
cellcomplex
->
getSize
(
0
)){
for
(
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
itt
=
itp
.
first
;
for
(
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
itt
=
itp
.
first
;
...
...
This diff is collapsed.
Click to expand it.
Geo/Homology.cpp
+
6
−
3
View file @
a4bf0b0d
...
@@ -15,10 +15,12 @@
...
@@ -15,10 +15,12 @@
#if defined(HAVE_KBIPACK)
#if defined(HAVE_KBIPACK)
Homology
::
Homology
(
GModel
*
model
,
std
::
vector
<
int
>
physicalDomain
,
Homology
::
Homology
(
GModel
*
model
,
std
::
vector
<
int
>
physicalDomain
,
std
::
vector
<
int
>
physicalSubdomain
,
bool
save0N
,
std
::
vector
<
int
>
physicalSubdomain
,
bool
save0N
,
bool
saveOrig
,
bool
combine
,
bool
omit
,
bool
smoothen
)
:
bool
combine
,
bool
omit
,
bool
smoothen
)
:
_model
(
model
),
_domain
(
physicalDomain
),
_subdomain
(
physicalSubdomain
),
_model
(
model
),
_domain
(
physicalDomain
),
_subdomain
(
physicalSubdomain
),
_save0N
(
save0N
),
_combine
(
combine
),
_omit
(
omit
),
_smoothen
(
smoothen
)
_save0N
(
save0N
),
_saveOrig
(
saveOrig
),
_combine
(
combine
),
_omit
(
omit
),
_smoothen
(
smoothen
)
{
{
_fileName
=
""
;
_fileName
=
""
;
...
@@ -90,7 +92,8 @@ CellComplex* Homology::createCellComplex(std::vector<GEntity*>& domainEntities,
...
@@ -90,7 +92,8 @@ CellComplex* Homology::createCellComplex(std::vector<GEntity*>& domainEntities,
CellComplex
*
cellComplex
=
new
CellComplex
(
_model
,
CellComplex
*
cellComplex
=
new
CellComplex
(
_model
,
domainElements
,
domainElements
,
subdomainElements
);
subdomainElements
,
_saveOrig
);
if
(
cellComplex
->
getSize
(
0
)
==
0
){
if
(
cellComplex
->
getSize
(
0
)
==
0
){
Msg
::
Error
(
"Cell Complex is empty: check the domain and the mesh"
);
Msg
::
Error
(
"Cell Complex is empty: check the domain and the mesh"
);
...
...
This diff is collapsed.
Click to expand it.
Geo/Homology.h
+
3
−
1
View file @
a4bf0b0d
...
@@ -52,6 +52,7 @@ class Homology
...
@@ -52,6 +52,7 @@ class Homology
// save chains of 0 and highest dimension
// save chains of 0 and highest dimension
bool
_save0N
;
bool
_save0N
;
bool
_saveOrig
;
int
_maxdomain
;
int
_maxdomain
;
int
_maxnum
;
int
_maxnum
;
...
@@ -64,7 +65,8 @@ class Homology
...
@@ -64,7 +65,8 @@ class Homology
public:
public:
Homology
(
GModel
*
model
,
std
::
vector
<
int
>
physicalDomain
,
Homology
(
GModel
*
model
,
std
::
vector
<
int
>
physicalDomain
,
std
::
vector
<
int
>
physicalSubdomain
,
bool
save0N
=
false
,
std
::
vector
<
int
>
physicalSubdomain
,
bool
save0N
=
false
,
bool
saveOrig
=
true
,
bool
combine
=
true
,
bool
omit
=
true
,
bool
smoothen
=
true
);
bool
combine
=
true
,
bool
omit
=
true
,
bool
smoothen
=
true
);
~
Homology
();
~
Homology
();
...
...
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