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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
20710b5b
Commit
20710b5b
authored
15 years ago
by
Matti Pellika
Browse files
Options
Downloads
Patches
Plain Diff
Some more.
parent
ec0b07db
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Geo/Cell.cpp
+10
-22
10 additions, 22 deletions
Geo/Cell.cpp
Geo/Cell.h
+6
-2
6 additions, 2 deletions
Geo/Cell.h
Geo/CellComplex.cpp
+23
-37
23 additions, 37 deletions
Geo/CellComplex.cpp
Geo/CellComplex.h
+1
-1
1 addition, 1 deletion
Geo/CellComplex.h
Geo/ChainComplex.cpp
+2
-4
2 additions, 4 deletions
Geo/ChainComplex.cpp
with
42 additions
and
66 deletions
Geo/Cell.cpp
+
10
−
22
View file @
20710b5b
...
...
@@ -283,27 +283,21 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell() {
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
c2Boundary
;
c2
->
getBoundary
(
c2Boundary
);
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
c1Boundary
.
begin
();
it
!=
c1Boundary
.
end
();
it
++
){
for
(
biter
it
=
c1Boundary
.
begin
();
it
!=
c1Boundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
int
ori
=
(
*
it
).
second
;
cell
->
removeCoboundaryCell
(
c1
);
if
(
this
->
addBoundaryCell
(
ori
,
cell
))
cell
->
addCoboundaryCell
(
ori
,
this
);
}
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
c2Boundary
.
begin
();
it
!=
c2Boundary
.
end
();
it
++
){
for
(
biter
it
=
c2Boundary
.
begin
();
it
!=
c2Boundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
if
(
!
orMatch
)
(
*
it
).
second
=
-
1
*
(
*
it
).
second
;
int
ori
=
(
*
it
).
second
;
cell
->
removeCoboundaryCell
(
c2
);
if
(
co
){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it2
=
c1Boundary
.
find
(
cell
);
bool
old
=
false
;
if
(
it2
!=
c1Boundary
.
end
())
old
=
true
;
if
(
!
old
){
if
(
this
->
addBoundaryCell
(
ori
,
cell
))
{
cell
->
addCoboundaryCell
(
ori
,
this
);
}
biter
it2
=
c1Boundary
.
find
(
cell
);
if
(
it2
==
c1Boundary
.
end
()
&&
this
->
addBoundaryCell
(
ori
,
cell
))
{
cell
->
addCoboundaryCell
(
ori
,
this
);
}
}
else
{
...
...
@@ -317,27 +311,21 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell() {
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
c2Coboundary
;
c2
->
getCoboundary
(
c2Coboundary
);
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
c1Coboundary
.
begin
();
it
!=
c1Coboundary
.
end
();
it
++
){
for
(
biter
it
=
c1Coboundary
.
begin
();
it
!=
c1Coboundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
int
ori
=
(
*
it
).
second
;
cell
->
removeBoundaryCell
(
c1
);
if
(
this
->
addCoboundaryCell
(
ori
,
cell
))
cell
->
addBoundaryCell
(
ori
,
this
);
}
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
c2Coboundary
.
begin
();
it
!=
c2Coboundary
.
end
();
it
++
){
for
(
biter
it
=
c2Coboundary
.
begin
();
it
!=
c2Coboundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
if
(
!
orMatch
)
(
*
it
).
second
=
-
1
*
(
*
it
).
second
;
int
ori
=
(
*
it
).
second
;
cell
->
removeBoundaryCell
(
c2
);
if
(
!
co
){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it2
=
c1Coboundary
.
find
(
cell
);
bool
old
=
false
;
if
(
it2
!=
c1Coboundary
.
end
())
old
=
true
;
if
(
!
old
)
{
if
(
this
->
addCoboundaryCell
(
ori
,
cell
)){
cell
->
addBoundaryCell
(
ori
,
this
);
}
biter
it2
=
c1Coboundary
.
find
(
cell
);
if
(
it2
==
c1Coboundary
.
end
()
&&
this
->
addCoboundaryCell
(
ori
,
cell
)){
cell
->
addBoundaryCell
(
ori
,
this
);
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Geo/Cell.h
+
6
−
2
View file @
20710b5b
...
...
@@ -116,14 +116,18 @@ class Cell
// (co)boundary cell iterator
typedef
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
biter
;
biter
firstBoundary
(){
return
_boundary
.
begin
();
}
biter
lastBoundary
(){
return
_boundary
.
end
();
}
biter
firstCoboundary
(){
return
_coboundary
.
begin
();
}
biter
lastCoboundary
(){
return
_coboundary
.
end
();
}
virtual
int
getBoundarySize
()
{
return
_boundary
.
size
();
}
virtual
int
getCoboundarySize
()
{
return
_coboundary
.
size
();
}
// get the cell boundary
virtual
void
getBoundary
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>&
boundary
){
boundary
=
_boundary
;
}
virtual
void
getCoboundary
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>&
coboundary
){
virtual
void
getCoboundary
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>&
coboundary
){
coboundary
=
_coboundary
;
}
// add (co)boundary cell
...
...
This diff is collapsed.
Click to expand it.
Geo/CellComplex.cpp
+
23
−
37
View file @
20710b5b
...
...
@@ -277,14 +277,12 @@ void CellComplex::removeCell(Cell* cell, bool other){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
boundary
;
cell
->
getBoundary
(
boundary
);
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
coboundary
.
begin
();
it
!=
coboundary
.
end
();
it
++
){
for
(
Cell
::
biter
it
=
coboundary
.
begin
();
it
!=
coboundary
.
end
();
it
++
){
Cell
*
cbdCell
=
(
*
it
).
first
;
cbdCell
->
removeBoundaryCell
(
cell
,
other
);
}
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
boundary
.
begin
();
it
!=
boundary
.
end
();
it
++
){
for
(
Cell
::
biter
it
=
boundary
.
begin
();
it
!=
boundary
.
end
();
it
++
){
Cell
*
bdCell
=
(
*
it
).
first
;
bdCell
->
removeCoboundaryCell
(
cell
,
other
);
}
...
...
@@ -293,7 +291,7 @@ void CellComplex::removeCell(Cell* cell, bool other){
}
void
CellComplex
::
removeCellQset
(
Cell
*
&
cell
,
void
CellComplex
::
removeCellQset
(
Cell
*
cell
,
std
::
set
<
Cell
*
,
Less_Cell
>&
Qset
){
Qset
.
erase
(
cell
);
}
...
...
@@ -325,8 +323,7 @@ int CellComplex::coreduction(Cell* generator, int omitted){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
bd_s
;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
cbd_c
;
//std::list<Cell*> bd_s;
//std::list<Cell*> cbd_c;
Cell
*
s
;
int
round
=
0
;
while
(
!
Q
.
empty
()
){
...
...
@@ -336,9 +333,9 @@ int CellComplex::coreduction(Cell* generator, int omitted){
s
=
Q
.
front
();
Q
.
pop
();
removeCellQset
(
s
,
Qset
);
s
->
getBoundary
(
bd_s
);
if
(
bd_s
.
size
()
==
1
&&
inSameDomain
(
s
,
bd_s
.
begin
()
->
first
)
){
if
(
s
->
getBoundary
Size
()
==
1
&&
inSameDomain
(
s
,
s
->
firstBoundary
()
->
first
)
){
s
->
getBoundary
(
bd_s
);
removeCell
(
s
);
bd_s
.
begin
()
->
first
->
getCoboundary
(
cbd_c
);
enqueueCells
(
cbd_c
,
Q
,
Qset
);
...
...
@@ -347,10 +344,8 @@ int CellComplex::coreduction(Cell* generator, int omitted){
_store
.
at
(
omitted
-
1
).
insert
(
bd_s
.
begin
()
->
first
);
}
coreductions
++
;
}
else
if
(
bd_s
.
empty
()
){
else
if
(
s
->
getBoundarySize
()
==
0
){
s
->
getCoboundary
(
cbd_c
);
enqueueCells
(
cbd_c
,
Q
,
Qset
);
}
...
...
@@ -363,7 +358,6 @@ int CellComplex::coreduction(Cell* generator, int omitted){
int
CellComplex
::
reduction
(
int
dim
,
int
omitted
){
if
(
dim
<
1
||
dim
>
3
)
return
0
;
//std::list<Cell*> cbd_c;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
cbd_c
;
int
count
=
0
;
...
...
@@ -377,28 +371,25 @@ int CellComplex::reduction(int dim, int omitted){
Cell
*
cell
=
*
cit
;
cell
->
getCoboundary
(
cbd_c
);
if
(
cbd_c
.
size
()
==
1
&&
inSameDomain
(
cell
,
cbd_c
.
begin
()
->
first
)){
//&& ( (!cell->getImmune() && !cbd_c.front()->getImmune() ) )){
++
cit
;
removeCell
(
cbd_c
.
begin
()
->
first
);
removeCell
(
cell
);
if
(
dim
==
getDim
()
&&
omitted
>
0
){
_store
.
at
(
omitted
-
1
).
insert
(
cbd_c
.
begin
()
->
first
);
if
(
cell
->
getCoboundarySize
()
==
1
&&
inSameDomain
(
cell
,
cell
->
firstCoboundary
()
->
first
)){
++
cit
;
if
(
dim
==
getDim
()
&&
omitted
>
0
){
_store
.
at
(
omitted
-
1
).
insert
(
cell
->
firstCoboundary
()
->
first
);
}
count
++
;
reduced
=
true
;
removeCell
(
cell
->
firstCoboundary
()
->
first
);
removeCell
(
cell
);
count
++
;
reduced
=
true
;
}
if
(
getSize
(
dim
)
==
0
||
getSize
(
dim
-
1
)
==
0
)
break
;
cit
++
;
}
//if(!reduced && ignoreCells) { ignoreCells = false; reduced = true;}
}
return
count
;
}
/*
...
...
@@ -641,7 +632,6 @@ int CellComplex::cocombine(int dim){
std
::
queue
<
Cell
*>
Q
;
std
::
set
<
Cell
*
,
Less_Cell
>
Qset
;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
cbd_c
;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
bd_c
;
int
count
=
0
;
for
(
citer
cit
=
firstCell
(
dim
);
cit
!=
lastCell
(
dim
);
cit
++
){
...
...
@@ -654,10 +644,8 @@ int CellComplex::cocombine(int dim){
Cell
*
s
=
Q
.
front
();
Q
.
pop
();
s
->
getBoundary
(
bd_c
);
if
(
s
->
getBoundarySize
()
==
2
){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
bd_c
.
begin
();
Cell
::
biter
it
=
s
->
firstBoundary
();
int
or1
=
(
*
it
).
second
;
Cell
*
c1
=
(
*
it
).
first
;
it
++
;
...
...
@@ -706,7 +694,7 @@ int CellComplex::combine(int dim){
std
::
queue
<
Cell
*>
Q
;
std
::
set
<
Cell
*
,
Less_Cell
>
Qset
;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
cbd_c
;
//
std::map<Cell*, int, Less_Cell> cbd_c;
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
bd_c
;
int
count
=
0
;
...
...
@@ -720,11 +708,9 @@ int CellComplex::combine(int dim){
Cell
*
s
=
Q
.
front
();
Q
.
pop
();
s
->
getCoboundary
(
cbd_c
);
if
(
s
->
getCoboundarySize
()
==
2
){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
cbd_c
.
begin
();
Cell
::
biter
it
=
s
->
firstCoboundary
();
int
or1
=
(
*
it
).
second
;
Cell
*
c1
=
(
*
it
).
first
;
it
++
;
...
...
This diff is collapsed.
Click to expand it.
Geo/CellComplex.h
+
1
−
1
View file @
20710b5b
...
...
@@ -69,7 +69,7 @@ class CellComplex
void
enqueueCells
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>&
cells
,
std
::
queue
<
Cell
*>&
Q
,
std
::
set
<
Cell
*
,
Less_Cell
>&
Qset
);
// remove cell from the queue set
void
removeCellQset
(
Cell
*
&
cell
,
std
::
set
<
Cell
*
,
Less_Cell
>&
Qset
);
void
removeCellQset
(
Cell
*
cell
,
std
::
set
<
Cell
*
,
Less_Cell
>&
Qset
);
// for constructor
void
insert_cells
(
bool
subdomain
,
bool
boundary
);
...
...
This diff is collapsed.
Click to expand it.
Geo/ChainComplex.cpp
+
2
−
4
View file @
20710b5b
...
...
@@ -76,10 +76,8 @@ ChainComplex::ChainComplex(CellComplex* cellComplex){
cit
!=
cellComplex
->
lastCell
(
dim
);
cit
++
){
Cell
*
cell
=
*
cit
;
if
(
!
cell
->
inSubdomain
()){
std
::
map
<
Cell
*
,
int
,
Less_Cell
>
bdCell
;
cell
->
getBoundary
(
bdCell
);
for
(
std
::
map
<
Cell
*
,
int
,
Less_Cell
>::
iterator
it
=
bdCell
.
begin
();
it
!=
bdCell
.
end
();
it
++
){
for
(
Cell
::
biter
it
=
cell
->
firstBoundary
();
it
!=
cell
->
lastBoundary
();
it
++
){
Cell
*
bdCell
=
(
*
it
).
first
;
if
(
!
bdCell
->
inSubdomain
()){
int
old_elem
=
0
;
...
...
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