Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Core Modules
dune-common
Commits
2ccc2e44
Commit
2ccc2e44
authored
19 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
segfault in test fixed. test still not running, though
[[Imported from SVN: r2892]]
parent
0263fd44
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
grid/onedgrid.hh
+3
-0
3 additions, 0 deletions
grid/onedgrid.hh
grid/onedgrid/onedgrid.cc
+19
-6
19 additions, 6 deletions
grid/onedgrid/onedgrid.cc
grid/onedgrid/onedgridindexsets.hh
+27
-122
27 additions, 122 deletions
grid/onedgrid/onedgridindexsets.hh
with
49 additions
and
128 deletions
grid/onedgrid.hh
+
3
−
0
View file @
2ccc2e44
...
...
@@ -392,6 +392,9 @@ namespace Dune {
private
:
/** \brief Update all indices and ids */
void
setIndices
();
template
<
int
cd
>
OneDGridEntity
<
cd
,
dim
,
const
OneDGrid
>&
getRealEntity
(
typename
Traits
::
template
Codim
<
cd
>
::
Entity
&
entity
)
{
return
entity
.
realEntity
;
...
...
This diff is collapsed.
Click to expand it.
grid/onedgrid/onedgrid.cc
+
19
−
6
View file @
2ccc2e44
...
...
@@ -73,9 +73,8 @@ Dune::OneDGrid<dim,dimworld>::OneDGrid(int numElements, double leftBoundary, dou
double
newCoord
=
leftBoundary
+
i
*
(
rightBoundary
-
leftBoundary
)
/
numElements
;
OneDEntityImp
<
0
>*
newVertex
=
new
OneDEntityImp
<
0
>
(
0
,
newCoord
);
newVertex
->
levelIndex_
=
i
;
vertices
[
0
].
insert_after
(
vertices
[
0
].
rbegin
,
newVertex
);
}
// Init element set
...
...
@@ -86,12 +85,12 @@ Dune::OneDGrid<dim,dimworld>::OneDGrid(int numElements, double leftBoundary, dou
newElement
->
vertex_
[
0
]
=
it
;
it
=
it
->
succ_
;
newElement
->
vertex_
[
1
]
=
it
;
newElement
->
levelIndex_
=
i
;
elements
[
0
].
insert_after
(
elements
[
0
].
rbegin
,
newElement
);
}
setIndices
();
}
template
<
int
dim
,
int
dimworld
>
...
...
@@ -109,8 +108,6 @@ Dune::OneDGrid<dim,dimworld>::OneDGrid(const SimpleVector<OneDCType>& coords)
// Init vertex set
for
(
int
i
=
0
;
i
<
coords
.
size
();
i
++
)
{
OneDEntityImp
<
0
>*
newVertex
=
new
OneDEntityImp
<
0
>
(
0
,
coords
[
i
]);
newVertex
->
levelIndex_
=
i
;
vertices
[
0
].
insert_after
(
vertices
[
0
].
rbegin
,
newVertex
);
}
...
...
@@ -122,12 +119,12 @@ Dune::OneDGrid<dim,dimworld>::OneDGrid(const SimpleVector<OneDCType>& coords)
newElement
->
vertex_
[
0
]
=
it
;
it
=
it
->
succ_
;
newElement
->
vertex_
[
1
]
=
it
;
newElement
->
levelIndex_
=
i
;
elements
[
0
].
insert_after
(
elements
[
0
].
rbegin
,
newElement
);
}
setIndices
();
}
...
...
@@ -549,6 +546,8 @@ bool Dune::OneDGrid<dim,dimworld>::adapt()
// ////////////////////////////////////
// renumber vertices and elements
// ////////////////////////////////////
setIndices
();
#if 0
for (int i=1; i<=maxlevel(); i++) {
int idx = 0;
...
...
@@ -561,11 +560,25 @@ bool Dune::OneDGrid<dim,dimworld>::adapt()
eIt->levelIndex_ = idx++;
}
#endif
return
changedGrid
;
}
template
<
int
dim
,
int
dimworld
>
void
Dune
::
OneDGrid
<
dim
,
dimworld
>::
setIndices
()
{
levelIndexSets_
.
resize
(
maxlevel
()
+
1
);
for
(
int
i
=
0
;
i
<=
maxlevel
();
i
++
)
levelIndexSets_
[
i
].
update
(
*
this
,
i
);
leafIndexSet_
.
update
();
idSet_
.
update
();
}
template
<
int
dim
,
int
dimworld
>
void
Dune
::
OneDGrid
<
dim
,
dimworld
>::
globalRefine
(
int
refCount
)
...
...
This diff is collapsed.
Click to expand it.
grid/onedgrid/onedgridindexsets.hh
+
27
−
122
View file @
2ccc2e44
...
...
@@ -15,8 +15,6 @@ namespace Dune {
class
OneDGridLevelIndexSet
:
public
IndexSet
<
GridImp
,
OneDGridLevelIndexSet
<
GridImp
>
>
{
public:
/** \todo Temporary, to make the dune/fem stuff compile */
enum
{
ncodim
=
GridImp
::
dimension
+
1
};
/** \brief Default constructor
...
...
@@ -57,97 +55,38 @@ namespace Dune {
return
myTypes_
;
}
/** \todo Dummy method to please the fem stuff */
int
oldIndex
(
int
elNum
)
const
{
DUNE_THROW
(
NotImplemented
,
"oldIndex"
);
}
/** \todo Dummy method to please the fem stuff */
int
oldIndex
(
int
elNum
,
int
codim
)
const
{
DUNE_THROW
(
NotImplemented
,
"oldIndex"
);
}
/** \todo Dummy method to please the fem stuff */
int
newIndex
(
int
elNum
)
const
{
DUNE_THROW
(
NotImplemented
,
"oldIndex"
);
}
/** \todo Dummy method to please the fem stuff */
int
newIndex
(
int
elNum
,
int
codim
)
const
{
DUNE_THROW
(
NotImplemented
,
"oldIndex"
);
}
/** \todo Dummy method to please the fem stuff */
int
additionalSizeEstimate
()
const
{
DUNE_THROW
(
NotImplemented
,
"additionalSizeEstimate"
);
}
#if 0
/** \todo Should be private */
void
update
(
const
GridImp
&
grid
,
int
level
)
{
// Commit the index set to a specific level of a specific grid
grid_
=
&
grid
;
level_
=
level
;
const int dim = GridImp::dimension;
// ///////////////////////////////
// Init the element indices
// ///////////////////////////////
int numSimplices = 0;
int numPyramids = 0;
int numPrisms = 0;
int numCubes = 0;
typename GridImp::Traits::template Codim<0>::LevelIterator eIt = grid_->template lbegin<0>(level_);
typename GridImp::Traits::template Codim<0>::LevelIterator eEndIt = grid_->template lend<0>(level_);
for (; eIt!=eEndIt; ++eIt) {
switch (eIt->geometry().type()) {
case simplex :
UG_NS<dim>::levelIndex(grid_->template getRealEntity<0>(*eIt).target_) = numSimplices++;
break;
case pyramid :
UG_NS<dim>::levelIndex(grid_->template getRealEntity<0>(*eIt).target_) = numPyramids++;
break;
case prism :
UG_NS<dim>::levelIndex(grid_->template getRealEntity<0>(*eIt).target_) = numPrisms++;
break;
case cube :
UG_NS<dim>::levelIndex(grid_->template getRealEntity<0>(*eIt).target_) = numCubes++;
break;
default :
DUNE_THROW(GridError, "Found the GeometryType " << eIt->geometry().type()
<< ", which should never occur in a UGGrid!");
}
}
int
numElements
=
0
;
OneDEntityImp
<
1
>*
eIt
;
for
(
eIt
=
grid_
->
elements
[
level
].
begin
;
eIt
!=
NULL
;
eIt
=
eIt
->
succ_
)
eIt
->
levelIndex_
=
numElements
++
;
// Update the list of geometry types present
myTypes_.resize(0);
if (numSimplices > 0)
myTypes_.push_back(simplex);
if (numPyramids > 0)
myTypes_.push_back(pyramid);
if (numPrisms > 0)
myTypes_.push_back(prism);
if (numCubes > 0)
myTypes_.push_back(cube);
if
(
numElements
>
0
)
{
myTypes_
.
resize
(
1
);
myTypes_
[
0
]
=
cube
;
}
else
myTypes_
.
resize
(
0
);
// //////////////////////////////
// Init the vertex indices
// //////////////////////////////
typename GridImp::Traits::template Codim<dim>::LevelIterator vIt = grid_->template lbegin<dim>(level_);
typename GridImp::Traits::template Codim<dim>::LevelIterator vEndIt = grid_->template lend<dim>(level_);
int
id
=
0
;
for (; vIt!=vEndIt; ++vIt)
UG_NS<dim>::levelIndex(grid_->template getRealEntity<dim>(*vIt).target_) = id++;
OneDEntityImp
<
0
>*
vIt
;
for
(
vIt
=
grid_
->
vertices
[
level
].
begin
;
vIt
!=
NULL
;
vIt
=
vIt
->
succ_
)
vIt
->
levelIndex_
=
id
++
;
}
#endif
private
:
const
GridImp
*
grid_
;
int
level_
;
...
...
@@ -187,13 +126,8 @@ namespace Dune {
switch
(
type
)
{
case
simplex
:
return
numSimplices_
;
case
pyramid
:
return
numPyramids_
;
case
prism
:
return
numPrisms_
;
case
cube
:
return
num
Cube
s_
;
return
num
Element
s_
;
default
:
return
0
;
}
...
...
@@ -209,76 +143,47 @@ namespace Dune {
return
myTypes_
;
}
#if 0
/** \todo Should be private */
void
update
()
{
const int dim = GridImp::dimension;
// ///////////////////////////////
// Init the element indices
// ///////////////////////////////
numSimplices_ = 0;
numPyramids_ = 0;
numPrisms_ = 0;
numCubes_ = 0;
numElements_
=
0
;
typename
GridImp
::
Traits
::
template
Codim
<
0
>
::
LeafIterator
eIt
=
grid_
.
template
leafbegin
<
0
>();
typename
GridImp
::
Traits
::
template
Codim
<
0
>
::
LeafIterator
eEndIt
=
grid_
.
template
leafend
<
0
>();
for
(;
eIt
!=
eEndIt
;
++
eIt
)
{
switch (eIt->geometry().type()) {
case simplex :
UG_NS<dim>::leafIndex(grid_.template getRealEntity<0>(*eIt).target_) = numSimplices_++;
break;
case pyramid :
UG_NS<dim>::leafIndex(grid_.template getRealEntity<0>(*eIt).target_) = numPyramids_++;
break;
case prism :
UG_NS<dim>::leafIndex(grid_.template getRealEntity<0>(*eIt).target_) = numPrisms_++;
break;
case cube :
UG_NS<dim>::leafIndex(grid_.template getRealEntity<0>(*eIt).target_) = numCubes_++;
break;
default :
DUNE_THROW(GridError, "Found the GeometryType " << eIt->geometry().type()
<< ", which should never occur in a UGGrid!");
}
grid_
.
template
getRealEntity
<
0
>(
*
eIt
).
target_
->
leafIndex_
=
numElements_
++
;
}
// Update the list of geometry types present
myTypes_.resize(0);
if (numSimplices_ > 0)
myTypes_.push_back(simplex);
if (numPyramids_ > 0)
myTypes_.push_back(pyramid);
if (numPrisms_ > 0)
myTypes_.push_back(prism);
if (numCubes_ > 0)
myTypes_.push_back(cube);
if
(
numElements_
>
0
)
{
myTypes_
.
resize
(
1
);
myTypes_
[
0
]
=
cube
;
}
else
myTypes_
.
resize
(
0
);
// //////////////////////////////
// Init the vertex indices
// //////////////////////////////
typename GridImp::Traits::template Codim<
dim
>::LeafIterator vIt = grid_.template leafbegin<
dim
>();
typename GridImp::Traits::template Codim<
dim
>::LeafIterator vEndIt = grid_.template leafend<
dim
>();
typename
GridImp
::
Traits
::
template
Codim
<
1
>
::
LeafIterator
vIt
=
grid_
.
template
leafbegin
<
1
>();
typename
GridImp
::
Traits
::
template
Codim
<
1
>
::
LeafIterator
vEndIt
=
grid_
.
template
leafend
<
1
>();
numVertices_
=
0
;
for
(;
vIt
!=
vEndIt
;
++
vIt
)
UG_NS<dim>::leafIndex(
grid_.template getRealEntity<
dim
>(*vIt).target_
)
= numVertices_++;
grid_
.
template
getRealEntity
<
1
>(
*
vIt
).
target_
->
leafIndex_
=
numVertices_
++
;
}
#endif
private
:
const
GridImp
&
grid_
;
int
numSimplices_
;
int
numPyramids_
;
int
numPrisms_
;
int
numCubes_
;
int
numElements_
;
int
numVertices_
;
std
::
vector
<
GeometryType
>
myTypes_
;
...
...
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