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 TEUCHOS_TEST_FOR_EXCEPTION(dynamic_cast<const LabelCellPredicate*>(other) == 0,
00041 std::logic_error,
00042 "argument " << other->toXML()
00043 << " to LabelCellPredicate::lessThan() should be "
00044 "a LabelCellPredicate pointer.");
00045
00046 const LabelCellPredicate* op
00047 = dynamic_cast<const LabelCellPredicate*>(other);
00048
00049 return (labelIndices_ < op->labelIndices_);
00050 }
00051
00052 void LabelCellPredicate::testBatch(const Array<int>& cellLID,
00053 Array<int>& results) const
00054 {
00055 mesh().getLabels(cellDim(), cellLID, results);
00056 for (int i=0; i<cellLID.size(); i++)
00057 {
00058 int cellLabel = results[i];
00059 results[i] = labelIndices_.contains(cellLabel);
00060 }
00061 }
00062
00063 XMLObject LabelCellPredicate::toXML() const
00064 {
00065 XMLObject rtn("LabelCellPredicate");
00066 rtn.addAttribute("label", labelIndices_.toString());
00067 return rtn;
00068 }
00069