Nektar++
Public Member Functions | Public Attributes | List of all members
Nektar::Utilities::Composite Class Reference

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

#include <MeshElements.h>

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

Public Member Functions

 Composite ()
 
std::string GetXmlString (bool doSort=true)
 Generate the list of IDs of elements within this 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 1043 of file MeshElements.h.

Constructor & Destructor Documentation

Nektar::Utilities::Composite::Composite ( )
inline

Definition at line 1045 of file MeshElements.h.

1045 : m_reorder(true) {}
bool m_reorder
Determines whether items can be reordered.

Member Function Documentation

string Nektar::Utilities::Composite::GetXmlString ( bool  doSort = true)

Generate the list of IDs of elements within this composite.

Generate a Nektar++ string describing the composite.

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

Definition at line 330 of file MeshElements.cpp.

References Nektar::iterator, m_items, and m_tag.

331  {
332 
333 #if 0 // turn this option off since causes problem with InputNekpp.cpp
334  if (doSort)
335  {
336  element_id_less_than sortOperator;
337  sort(m_items.begin(), m_items.end(), sortOperator);
338  }
339 #endif
340 
341  stringstream st;
343  bool range = false;
344  int vId = m_items[0]->GetId();
345  int prevId = vId;
346 
347  st << " " << m_tag << "[" << vId;
348 
349  for (it = m_items.begin()+1; it != m_items.end(); ++it){
350  // store previous element ID and get current one
351  prevId = vId;
352  vId = (*it)->GetId();
353 
354  // continue an already started range
355  if (prevId > -1 && vId == prevId + 1)
356  {
357  range = true;
358  // if this is the last element, it's the end of a range, so write
359  if (*it == m_items.back())
360  {
361  st << "-" << vId;
362  }
363  continue;
364  }
365 
366  // terminate a range, if present
367  if (range)
368  {
369  st << "-" << prevId;
370  range = false;
371  }
372 
373  // write what will be either a single entry or start of new range
374  st << "," << vId;
375  }
376  // terminate
377  st << "] ";
378  return st.str();
379  }
std::vector< ElementSharedPtr > m_items
List of elements in this composite.
std::string m_tag
Element type tag.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator

Member Data Documentation

unsigned int Nektar::Utilities::Composite::m_id

ID of composite.

Definition at line 1051 of file MeshElements.h.

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

List of elements in this composite.

Definition at line 1059 of file MeshElements.h.

Referenced by GetXmlString().

std::string Nektar::Utilities::Composite::m_label

boundary label

Definition at line 1055 of file MeshElements.h.

bool Nektar::Utilities::Composite::m_reorder

Determines whether items can be reordered.

Definition at line 1057 of file MeshElements.h.

std::string Nektar::Utilities::Composite::m_tag

Element type tag.

Definition at line 1053 of file MeshElements.h.

Referenced by GetXmlString().