Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
Nektar::NekMeshUtils::Composite Class Reference

A composite is a collection of elements. More...

#include <Composite.h>

Collaboration diagram for Nektar::NekMeshUtils::Composite:
Collaboration graph
[legend]

Public Member Functions

NEKMESHUTILS_EXPORT Composite ()
 
NEKMESHUTILS_EXPORT std::string GetXmlString (bool doSort=true)
 Generate a Nektar++ string describing the composite. More...
 

Public Attributes

unsigned int m_id
 ID of composite. More...
 
std::string m_tag
 Element type tag. More...
 
std::string m_label
 boundary label More...
 
bool m_reorder
 Determines whether items can be reordered. More...
 
std::vector< ElementSharedPtrm_items
 List of elements in this composite. More...
 

Detailed Description

A composite is a collection of elements.

All elements should be of the same type, i.e. have the same tag.

Definition at line 51 of file Composite.h.

Constructor & Destructor Documentation

NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Composite::Composite ( )
inline

Definition at line 54 of file Composite.h.

54  : m_reorder(true)
55  {
56  }
bool m_reorder
Determines whether items can be reordered.
Definition: Composite.h:115

Member Function Documentation

NEKMESHUTILS_EXPORT std::string Nektar::NekMeshUtils::Composite::GetXmlString ( bool  doSort = true)
inline

Generate a Nektar++ string describing the composite.

The list of composites may include individual element IDs or ranges of element IDs.

Definition at line 64 of file Composite.h.

References Nektar::iterator, m_items, and m_tag.

65  {
66  stringstream st;
68  bool range = false;
69  int vId = m_items[0]->GetId();
70  int prevId = vId;
71 
72  st << " " << m_tag << "[" << vId;
73 
74  for (it = m_items.begin() + 1; it != m_items.end(); ++it)
75  {
76  // store previous element ID and get current one
77  prevId = vId;
78  vId = (*it)->GetId();
79 
80  // continue an already started range
81  if (prevId > -1 && vId == prevId + 1)
82  {
83  range = true;
84  // if this is the last element, it's the end of a range, so
85  // write
86  if (*it == m_items.back())
87  {
88  st << "-" << vId;
89  }
90  continue;
91  }
92 
93  // terminate a range, if present
94  if (range)
95  {
96  st << "-" << prevId;
97  range = false;
98  }
99 
100  // write what will be either a single entry or start of new range
101  st << "," << vId;
102  }
103  // terminate
104  st << "] ";
105  return st.str();
106  }
std::vector< ElementSharedPtr > m_items
List of elements in this composite.
Definition: Composite.h:117
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::string m_tag
Element type tag.
Definition: Composite.h:111

Member Data Documentation

unsigned int Nektar::NekMeshUtils::Composite::m_id

ID of composite.

Definition at line 109 of file Composite.h.

std::vector<ElementSharedPtr> Nektar::NekMeshUtils::Composite::m_items

List of elements in this composite.

Definition at line 117 of file Composite.h.

Referenced by GetXmlString().

std::string Nektar::NekMeshUtils::Composite::m_label

boundary label

Definition at line 113 of file Composite.h.

bool Nektar::NekMeshUtils::Composite::m_reorder

Determines whether items can be reordered.

Definition at line 115 of file Composite.h.

std::string Nektar::NekMeshUtils::Composite::m_tag

Element type tag.

Definition at line 111 of file Composite.h.

Referenced by GetXmlString().