[Dune] [Dune-Commit] dune-grid r6432 - trunk/dune/grid/onedgrid
Oliver Sander
sander at mi.fu-berlin.de
Sun Mar 14 12:10:32 CET 2010
Please!
--
Oliver
Christian Engwer schrieb:
> Do I assume correctly that this patch should be merged?
>
> christian
>
> On Sat, Mar 13, 2010 at 07:15:07PM +0100, sander at dune-project.org wrote:
>
>> Author: sander
>> Date: 2010-03-13 19:15:07 +0100 (Sat, 13 Mar 2010)
>> New Revision: 6432
>>
>> Modified:
>> trunk/dune/grid/onedgrid/onedgridfactory.cc
>> trunk/dune/grid/onedgrid/onedgridindexsets.hh
>> Log:
>> vertices in a newly created grid are now numbered by insertion order
>>
>> Modified: trunk/dune/grid/onedgrid/onedgridfactory.cc
>> ===================================================================
>> --- trunk/dune/grid/onedgrid/onedgridfactory.cc 2010-03-13 13:20:36 UTC (rev 6431)
>> +++ trunk/dune/grid/onedgrid/onedgridfactory.cc 2010-03-13 18:15:07 UTC (rev 6432)
>> @@ -1,6 +1,7 @@
>> #include <config.h>
>>
>> #include <dune/grid/onedgrid/onedgridfactory.hh>
>> +#include <dune/grid/onedgrid/onedgridindexsets.hh>
>>
>> using namespace Dune;
>>
>> @@ -101,6 +102,10 @@
>> it = it->succ_;
>> newElement.vertex_[1] = it;
>>
>> + // temporary: indices chosen by geographic ordering, not by insertion ordering
>> + newElement.levelIndex_ = i;
>> + newElement.leafIndex_ = i;
>> +
>> grid_->elements(0).push_back(newElement);
>>
>> }
>> @@ -109,8 +114,12 @@
>> // Create the index sets
>> // ///////////////////////////////////////////////////
>>
>> - grid_->setIndices();
>> + grid_->levelIndexSets_.resize(1);
>> + grid_->levelIndexSets_[0] = new OneDGridLevelIndexSet<const OneDGrid>(*grid_, 0);
>> + grid_->levelIndexSets_[0]->setSizesAndTypes(vertexPositions_.size(), elements_.size());
>>
>> + grid_->leafIndexSet_.setSizesAndTypes(vertexPositions_.size(), elements_.size());
>> +
>> // ///////////////////////////////////////////////////
>> // hand over the grid and delete the member pointer
>> // ///////////////////////////////////////////////////
>>
>> Modified: trunk/dune/grid/onedgrid/onedgridindexsets.hh
>> ===================================================================
>> --- trunk/dune/grid/onedgrid/onedgridindexsets.hh 2010-03-13 13:20:36 UTC (rev 6431)
>> +++ trunk/dune/grid/onedgrid/onedgridindexsets.hh 2010-03-13 18:15:07 UTC (rev 6432)
>> @@ -91,6 +91,29 @@
>> return false;
>> }
>>
>> + /** \brief Sets the corresponding internal fields. Used by the GridFactory */
>> + void setSizesAndTypes(unsigned int numVertices, unsigned int numElements) {
>> +
>> + numVertices_ = numVertices;
>> + numElements_ = numElements;
>> +
>> + // ///////////////////////////////////////////////
>> + // Update the list of geometry types present
>> + // ///////////////////////////////////////////////
>> + if (numElements_>0) {
>> + myTypes_[0].resize(1);
>> + myTypes_[0][0] = GeometryType(1);
>> + } else
>> + myTypes_[0].resize(0);
>> +
>> + if (numVertices_>0) {
>> + myTypes_[1].resize(1);
>> + myTypes_[1][0] = GeometryType(0);
>> + } else
>> + myTypes_[1].resize(0);
>> +
>> + }
>> +
>> /** \todo Should be private */
>> void update() {
>>
>> @@ -113,20 +136,8 @@
>> /** \todo Remove this const cast */
>> const_cast<OneDEntityImp<0>*>(vIt)->levelIndex_ = numVertices_++;
>>
>> - // ///////////////////////////////////////////////
>> - // Update the list of geometry types present
>> - // ///////////////////////////////////////////////
>> - if (numElements_>0) {
>> - myTypes_[0].resize(1);
>> - myTypes_[0][0] = GeometryType(1);
>> - } else
>> - myTypes_[0].resize(0);
>> -
>> - if (numVertices_>0) {
>> - myTypes_[1].resize(1);
>> - myTypes_[1][0] = GeometryType(0);
>> - } else
>> - myTypes_[1].resize(0);
>> + // set the list of geometry types
>> + setSizesAndTypes(numVertices_, numElements_);
>> }
>>
>> private:
>> @@ -240,6 +251,29 @@
>> return false;
>> }
>>
>> + /** \brief Sets the corresponding internal fields. Used by the GridFactory */
>> + void setSizesAndTypes(unsigned int numVertices, unsigned int numElements) {
>> +
>> + numVertices_ = numVertices;
>> + numElements_ = numElements;
>> +
>> + // ///////////////////////////////////////////////
>> + // Update the list of geometry types present
>> + // ///////////////////////////////////////////////
>> + if (numElements_>0) {
>> + myTypes_[0].resize(1);
>> + myTypes_[0][0] = GeometryType(1);
>> + } else
>> + myTypes_[0].resize(0);
>> +
>> + if (numVertices_>0) {
>> + myTypes_[1].resize(1);
>> + myTypes_[1][0] = GeometryType(0);
>> + } else
>> + myTypes_[1].resize(0);
>> +
>> + }
>> +
>> /** \todo Should be private */
>> void update() {
>>
>> @@ -277,21 +311,9 @@
>>
>> }
>>
>> - // ///////////////////////////////////////////////
>> - // Update the list of geometry types present
>> - // ///////////////////////////////////////////////
>> - if (numElements_>0) {
>> - myTypes_[0].resize(1);
>> - myTypes_[0][0] = GeometryType(1);
>> - } else
>> - myTypes_[0].resize(0);
>> + // set the list of geometry types
>> + setSizesAndTypes(numVertices_, numElements_);
>>
>> - if (numVertices_>0) {
>> - myTypes_[1].resize(1);
>> - myTypes_[1][0] = GeometryType(0);
>> - } else
>> - myTypes_[1].resize(0);
>> -
>> }
>>
>> private:
>>
>>
>> _______________________________________________
>> Dune-Commit mailing list
>> Dune-Commit at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>
>>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
--
************************************************************************
* Oliver Sander ** email: sander at mi.fu-berlin.de *
* Freie Universität Berlin ** phone: + 49 (30) 838 75348 *
* Institut für Mathematik ** URL : page.mi.fu-berlin.de/~sander *
* Arnimallee 6 ** -------------------------------------*
* 14195 Berlin, Germany ** Member of MATHEON (www.matheon.de) *
************************************************************************
More information about the Dune
mailing list