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
6cc19b5d
Commit
6cc19b5d
authored
13 years ago
by
Matti Pellika
Browse files
Options
Downloads
Patches
Plain Diff
Fix & cleanup
parent
6857a548
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Geo/CellComplex.cpp
+23
-20
23 additions, 20 deletions
Geo/CellComplex.cpp
Geo/CellComplex.h
+2
-0
2 additions, 0 deletions
Geo/CellComplex.h
Geo/GModel.cpp
+2
-1
2 additions, 1 deletion
Geo/GModel.cpp
with
27 additions
and
21 deletions
Geo/CellComplex.cpp
+
23
−
20
View file @
6cc19b5d
...
...
@@ -14,7 +14,7 @@ CellComplex::CellComplex(GModel* model,
bool
saveOriginalComplex
)
:
_model
(
model
),
_dim
(
0
),
_simplicial
(
true
),
_saveorig
(
saveOriginalComplex
)
{
_deleteCount
=
0
;
_insertCells
(
subdomainElements
,
1
);
_insertCells
(
domainElements
,
0
);
...
...
@@ -76,22 +76,31 @@ CellComplex::~CellComplex()
for
(
citer
cit
=
_ocells
[
i
].
begin
();
cit
!=
_ocells
[
i
].
end
();
cit
++
){
Cell
*
cell
=
*
cit
;
delete
cell
;
_deleteCount
++
;
}
}
else
{
for
(
citer
cit
=
_cells
[
i
].
begin
();
cit
!=
_cells
[
i
].
end
();
cit
++
){
Cell
*
cell
=
*
cit
;
delete
cell
;
_deleteCount
++
;
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
_newcells
.
size
();
i
++
)
{
delete
_newcells
.
at
(
i
);
_deleteCount
++
;
}
for
(
unsigned
int
i
=
0
;
i
<
_removedcells
.
size
();
i
++
)
{
delete
_removedcells
.
at
(
i
);
_deleteCount
++
;
}
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
);
Msg
::
Debug
(
"Total number of cells created: %d"
,
_deleteCount
);
}
void
CellComplex
::
insertCell
(
Cell
*
cell
)
{
_newcells
.
push_back
(
cell
);
if
(
_saveorig
)
_newcells
.
push_back
(
cell
);
std
::
pair
<
citer
,
bool
>
insertInfo
=
_cells
[
cell
->
getDim
()].
insert
(
cell
);
if
(
!
insertInfo
.
second
){
Msg
::
Debug
(
"Cell not inserted"
);
...
...
@@ -103,35 +112,26 @@ void CellComplex::insertCell(Cell* cell)
void
CellComplex
::
removeCell
(
Cell
*
cell
,
bool
other
)
{
//if(!hasCell(cell)) return;
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
coboundary
;
cell
->
getCoboundary
(
coboundary
);
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>
boundary
;
cell
->
getBoundary
(
boundary
);
for
(
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>::
iterator
it
=
coboundary
.
begin
();
it
!=
coboundary
.
end
();
it
++
){
for
(
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>::
iterator
it
=
coboundary
.
begin
();
it
!=
coboundary
.
end
();
it
++
){
Cell
*
cbdCell
=
(
*
it
).
first
;
cbdCell
->
removeBoundaryCell
(
cell
,
other
);
}
for
(
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>::
iterator
it
=
boundary
.
begin
();
it
!=
boundary
.
end
();
it
++
){
for
(
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>::
iterator
it
=
boundary
.
begin
();
it
!=
boundary
.
end
();
it
++
){
Cell
*
bdCell
=
(
*
it
).
first
;
bdCell
->
removeCoboundaryCell
(
cell
,
other
);
}
/* for(Cell::biter it = cell->firstCoboundary(); it != cell->lastCoboundary(); it++){
Cell* cbdCell = (*it).first;
cbdCell->removeBoundaryCell(cell, false);
}
for(Cell::biter it = cell->firstBoundary(); it != cell->lastBoundary(); it++){
Cell* bdCell = (*it).first;
bdCell->removeCoboundaryCell(cell, false);
}*/
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
)
_removedcells
.
push_back
(
cell
);
}
void
CellComplex
::
enqueueCells
(
std
::
map
<
Cell
*
,
short
int
,
Less_Cell
>&
cells
,
...
...
@@ -362,7 +362,6 @@ int CellComplex::coreduceComplex(bool docombine, bool omit)
if
(
docombine
)
cocombine
(
2
);
coreduction
(
3
,
false
,
empty
);
coherent
();
Msg
::
Debug
(
" %d volumes, %d faces, %d edges and %d vertices"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
...
...
@@ -573,11 +572,15 @@ bool CellComplex::restoreComplex()
for
(
unsigned
int
i
=
0
;
i
<
_newcells
.
size
();
i
++
){
Cell
*
cell
=
_newcells
.
at
(
i
);
delete
cell
;
_deleteCount
++
;
}
_newcells
.
clear
();
return
true
;
}
else
return
false
;
else
{
Msg
::
Error
(
"Cannot restore cell complex"
);
return
false
;
}
}
void
CellComplex
::
printComplex
(
int
dim
)
...
...
This diff is collapsed.
Click to expand it.
Geo/CellComplex.h
+
2
−
0
View file @
6cc19b5d
...
...
@@ -42,6 +42,8 @@ class CellComplex
int
_dim
;
bool
_saveorig
;
int
_deleteCount
;
// for constructor
bool
_insertCells
(
std
::
vector
<
MElement
*>&
elements
,
int
domain
);
...
...
This diff is collapsed.
Click to expand it.
Geo/GModel.cpp
+
2
−
1
View file @
6cc19b5d
...
...
@@ -2764,7 +2764,8 @@ void GModel::computeHomology()
std
::
pair
<
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
,
std
::
multimap
<
dpair
,
std
::
string
>::
iterator
>
itp
=
_homologyRequests
.
equal_range
(
*
it
);
bool
prepareToRestore
=
(
itp
.
first
!=
itp
.
second
);
bool
prepareToRestore
=
(
itp
.
first
!=
--
itp
.
second
);
itp
.
second
++
;
Homology
*
homology
=
new
Homology
(
this
,
itp
.
first
->
first
.
first
,
itp
.
first
->
first
.
second
,
false
,
prepareToRestore
);
CellComplex
*
cellcomplex
=
homology
->
createCellComplex
();
...
...
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