Select Git revision
functional.h
MNeighbour.h 72.29 KiB
#ifndef _MNEIGHBOUR_H_
#define _MNEIGHBOUR_H_
// Copyright (C) 2006 S. Guzik, C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to <gmsh@geuz.org>.
/*******************************************************************************
*
* - The classes in this file construct a database of the elements that share
* the lower-dimensional bounding objects (e.g., vertex, edge, or face).
* These lower-dimensional objects are referred to in general as polytopes.
* - Templated traits classes are used extensively to define the characteristics
* of the elements and the entities.
*
******************************************************************************/
#include <algorithm>
#include <iterator>
#include <vector>
#include "MElement.h"
#include "GEdge.h"
#include "GFace.h"
#include "GRegion.h"
#include "MEdgeHash.h"
#include "MFaceHash.h"
#include "GmshDefines.h"
// #define HAVE_HASH_MAP
#if defined(HAVE_HASH_MAP)
#include "HashMap.h"
#endif
/*==============================================================================
* File scope types
*============================================================================*/
namespace {
typedef std::list<MElement*> Neighbours;
typedef Neighbours::const_iterator NeighboursConstIterator;
typedef Neighbours::iterator NeighboursIterator;
struct Range_t
{
int num;
NeighboursIterator begin;
Range_t() : num(0) { }
};
//--Use a hash map for neighbour lookup if possible, otherwise a map will do
#if defined(HAVE_HASH_MAP)