00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "SundanceCellIterator.hpp"
00032 #include "SundanceCellFilter.hpp"
00033 #include "SundanceOut.hpp"
00034
00035 using namespace Sundance;
00036 using namespace Sundance;
00037 using namespace Sundance;
00038 using namespace Teuchos;
00039
00040 CellIterator::CellIterator()
00041 : isImplicit_(true),
00042 currentLID_(-1),
00043 reorderer_(0),
00044 iter_(dummy().begin())
00045 {;}
00046
00047 CellIterator::CellIterator(const CellIterator& other)
00048 : isImplicit_(other.isImplicit_),
00049 currentLID_(other.currentLID_),
00050 reorderer_(other.reorderer_),
00051 iter_()
00052 {
00053 if (!isImplicit_) iter_ = other.iter_;
00054 }
00055
00056 CellIterator::CellIterator(const Mesh& mesh,
00057 int cellDim,
00058 CellIteratorPos pos)
00059 : isImplicit_(true),
00060 currentLID_(-1),
00061 reorderer_(mesh.reorderer()),
00062 iter_(dummy().begin())
00063 {
00064 if (cellDim == mesh.spatialDim() && reorderer_ != 0)
00065 {
00066 switch(pos)
00067 {
00068 case Begin:
00069 currentLID_ = reorderer_->begin();
00070 break;
00071 case End:
00072 currentLID_ = mesh.numCells(cellDim);
00073 }
00074 SUNDANCE_OUT(mesh.verb() > 2,
00075 "created implicit cell iterator with LID=" << currentLID_);
00076 }
00077 else
00078 {
00079 switch(pos)
00080 {
00081 case Begin:
00082 currentLID_ = 0;
00083 break;
00084 case End:
00085 currentLID_ = mesh.numCells(cellDim);
00086 }
00087 SUNDANCE_OUT(mesh.verb() > 2,
00088 "created implicit cell iterator with LID=" << currentLID_);
00089 }
00090
00091
00092 }
00093
00094
00095
00096 CellIterator::CellIterator(const Set<int>* cells, CellIteratorPos pos)
00097 : isImplicit_(false),
00098 currentLID_(-1),
00099 reorderer_(0),
00100 iter_(dummy().begin())
00101 {
00102 switch(pos)
00103 {
00104 case Begin:
00105 iter_ = cells->begin();
00106 break;
00107 case End:
00108 iter_ = cells->end();
00109 break;
00110 default:
00111 TEUCHOS_TEST_FOR_EXCEPT(1);
00112 }
00113 }
00114
00115
00116
00117 CellIterator& CellIterator::operator=(const CellIterator& other)
00118 {
00119 if (*this!=other)
00120 {
00121 isImplicit_ = other.isImplicit_;
00122 currentLID_ = other.currentLID_;
00123 reorderer_=other.reorderer_;
00124 if (!isImplicit_) iter_ = other.iter_;
00125 }
00126 return *this;
00127 }
00128
00129