Go to the documentation of this file.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 "SundanceLabelCellPredicate.hpp"
00032
00033 using namespace Sundance;
00034 using namespace Sundance;
00035 using namespace Sundance;
00036 using namespace Teuchos;
00037
00038 bool LabelCellPredicate::lessThan(const CellPredicateBase* other) const
00039 {
00040 TEST_FOR_EXCEPTION(dynamic_cast<const LabelCellPredicate*>(other) == 0,
00041 InternalError,
00042 "argument " << other->toXML()
00043 << " to LabelCellPredicate::lessThan() should be "
00044 "a LabelCellPredicate pointer.");
00045
00046 return labelIndex_ < dynamic_cast<const LabelCellPredicate*>(other)->labelIndex_;
00047 }
00048
00049 void LabelCellPredicate::testBatch(const Array<int>& cellLID,
00050 Array<int>& results) const
00051 {
00052 mesh().getLabels(cellDim(), cellLID, results);
00053 for (int i=0; i<cellLID.size(); i++)
00054 {
00055 results[i] = (results[i] == labelIndex_);
00056 }
00057 }
00058
00059 XMLObject LabelCellPredicate::toXML() const
00060 {
00061 XMLObject rtn("LabelCellPredicate");
00062 rtn.addAttribute("label", Teuchos::toString(labelIndex_));
00063 return rtn;
00064 }
00065