Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_CheckBCConsistency.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
12 #include "Panzer_BC.hpp"
13 
14 namespace panzer {
15 
16  void checkBCConsistency(const std::vector<std::string>& element_block_names,
17  const std::vector<std::string>& sideset_names,
18  const std::vector<panzer::BC>& bcs)
19  {
20  for (const auto& bc : bcs) {
21  const auto eb_search = std::find(element_block_names.begin(),
22  element_block_names.end(),
23  bc.elementBlockID());
24 
25  TEUCHOS_TEST_FOR_EXCEPTION(eb_search == element_block_names.end(),
26  std::runtime_error,
27  "ERROR: the element block \"" << bc.elementBlockID()
28  << "\" for boundary condition \"" << bc.bcID()
29  << "\" does not exist in the mesh.");
30 
31  const auto ss_search = std::find(sideset_names.begin(),
32  sideset_names.end(),
33  bc.sidesetID());
34 
35  TEUCHOS_TEST_FOR_EXCEPTION(ss_search == sideset_names.end(),
36  std::runtime_error,
37  "ERROR: the element block \"" << bc.sidesetID()
38  << "\" for boundary condition \"" << bc.bcID()
39  << "\" does not exist in the mesh.");
40  }
41  }
42 
43 }
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void checkBCConsistency(const std::vector< std::string > &element_block_names, const std::vector< std::string > &sideset_names, const std::vector< panzer::BC > &bcs)