• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Albany_DiscretizationDofListProvider.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #include "Albany_DiscretizationDofListProvider.hpp"
00008 
00009 #include "Teuchos_Array.hpp"
00010 
00011 #include "Teuchos_TestForException.hpp"
00012 
00013 #include <vector>
00014 #include <string>
00015 
00016 namespace Albany {
00017 
00018 DiscretizationSampleDofListProvider::DiscretizationSampleDofListProvider(
00019     const Teuchos::RCP<const AbstractDiscretization> &disc) :
00020   disc_(disc)
00021 {
00022   // Nothing to do
00023 }
00024 
00025 Teuchos::Array<int>
00026 DiscretizationSampleDofListProvider::operator()(const Teuchos::RCP<Teuchos::ParameterList> &/*params*/)
00027 {
00028   Teuchos::Array<int> result;
00029   {
00030     const NodeSetList &allNodeSets = disc_->getNodeSets();
00031 
00032     const std::string nodeSetName = "sample_nodes";
00033     const NodeSetList::const_iterator it = allNodeSets.find(nodeSetName);
00034     TEUCHOS_TEST_FOR_EXCEPTION(
00035         it == allNodeSets.end(),
00036         std::out_of_range,
00037         "Nodeset " << nodeSetName << " does not exist");
00038 
00039     typedef NodeSetList::mapped_type NodeSetEntryList;
00040     const NodeSetEntryList &sampleNodeEntries = it->second;
00041     for (NodeSetEntryList::const_iterator jt = sampleNodeEntries.begin(); jt != sampleNodeEntries.end(); ++jt) {
00042       typedef NodeSetEntryList::value_type NodeEntryList;
00043       const NodeEntryList &sampleEntries = *jt;
00044       for (NodeEntryList::const_iterator kt = sampleEntries.begin(); kt != sampleEntries.end(); ++kt) {
00045         result.push_back(*kt);
00046       }
00047     }
00048   }
00049   return result;
00050 }
00051 
00052 } // end namespace Albany

Generated on Wed Mar 26 2014 18:36:36 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1