Loading...
Searching...
No Matches
solventExcludedSurface.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_STRUCTURE_SOLVENTEXCLUDEDSURFACE_H
#define BALL_STRUCTURE_SOLVENTEXCLUDEDSURFACE_H
#ifndef BALL_STRUCTURE_SESEDGE_H
# include <BALL/STRUCTURE/SESEdge.h>
#endif
#ifndef BALL_STRUCTURE_SESFACE_H
# include <BALL/STRUCTURE/SESFace.h>
#endif
#ifndef BALL_STRUCTURE_SESVERTEX_H
# include <BALL/STRUCTURE/SESVertex.h>
#endif
#ifndef BALL_STRUCTURE_REDUCEDSURFACE_H
# include <BALL/STRUCTURE/reducedSurface.h>
#endif
#ifndef BALL_MATHS_ANGLE_H
# include <BALL/MATHS/angle.h>
#endif
#ifndef BALL_MATHS_CIRCLE3_H
# include <BALL/MATHS/circle3.h>
#endif
#ifndef BALL_MATHS_SPHERE3_H
# include <BALL/MATHS/sphere3.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_MATHS_VECTOR4_H
# include <BALL/MATHS/vector4.h>
#endif
#ifndef BALL_DATATYPE_HASHGRID_H
# include <BALL/DATATYPE/hashGrid.h>
#endif
#ifndef BALL_DATATYPE_HASHMAP_H
# include <BALL/DATATYPE/hashMap.h>
#endif
#include <vector>
#include <list>
namespace BALL
{
class SESComputer;
class SESSingularityCleaner;
class TriangulatedSES;
class SESTriangulator;
class BALL_EXPORT SolventExcludedSurface
{
public:
friend class SESComputer;
friend class SESSingularityCleaner;
friend class TriangulatedSES;
friend class SESTriangulator;
BALL_CREATE(SolventExcludedSurface)
typedef std::vector<SESVertex*>::iterator
VertexIterator;
typedef std::vector<SESVertex*>::const_iterator
ConstVertexIterator;
typedef std::vector<SESEdge*>::iterator
EdgeIterator;
typedef std::vector<SESEdge*>::const_iterator
ConstEdgeIterator;
typedef std::list<SESEdge*>::iterator
SingularEdgeIterator;
typedef std::list<SESEdge*>::const_iterator
ConstSingularEdgeIterator;
typedef std::vector<SESFace*>::iterator
ContactFaceIterator;
typedef std::vector<SESFace*>::const_iterator
ConstContactFaceIterator;
typedef std::vector<SESFace*>::iterator
SphericFaceIterator;
typedef std::vector<SESFace*>::const_iterator
ConstSphericFaceIterator;
typedef std::vector<SESFace*>::iterator
ToricFaceIterator;
typedef std::vector<SESFace*>::const_iterator
ConstToricFaceIterator;
SolventExcludedSurface();
SolventExcludedSurface
(const SolventExcludedSurface& ses, bool = false);
SolventExcludedSurface(ReducedSurface* reduced_surface);
virtual ~SolventExcludedSurface()
;
void clear();
void clean(const double& density);
void compute();
void splitSphericFaces()
;
bool check()
;
VertexIterator beginVertex()
;
ConstVertexIterator beginVertex() const
;
VertexIterator endVertex()
;
ConstVertexIterator endVertex() const
;
EdgeIterator beginEdge()
;
ConstEdgeIterator beginEdge() const
;
EdgeIterator endEdge()
;
ConstEdgeIterator endEdge() const
;
SingularEdgeIterator beginSingularEdge()
;
ConstSingularEdgeIterator beginSingularEdge() const
;
SingularEdgeIterator endSingularEdge()
;
ConstSingularEdgeIterator endSingularEdge() const
;
ContactFaceIterator beginContactFace()
;
ConstContactFaceIterator beginContactFace() const
;
ContactFaceIterator endContactFace()
;
ConstContactFaceIterator endContactFace() const
;
SphericFaceIterator beginSphericFace()
;
ConstSphericFaceIterator beginSphericFace() const
;
SphericFaceIterator endSphericFace()
;
ConstSphericFaceIterator endSphericFace() const
;
ToricFaceIterator beginToricFace()
;
ConstToricFaceIterator beginToricFace() const
;
ToricFaceIterator endToricFace()
;
ConstToricFaceIterator endToricFace() const
;
private:
void splitSphericFace(Position i)
;
void deleteSmallToricFace(SESFace* face)
;
void deleteSmallSingularToricFace(SESFace* face)
;
bool cleanToricFace(SESFace* face, const double& sqrt_density)
;
bool cleanSingularToricFace(SESFace* face, const double& sqrt_density)
;
void cleanVertices()
;
void cleanEdges()
;
void cleanContactFaces()
;
void cleanToricFaces()
;
void cleanSphericFaces()
;
protected:
/*_ the number of vertices of the solvent exluded surface
*/
Position number_of_vertices_;
/*_ the vertices of the solvent exluded surface
*/
::std::vector<SESVertex*> vertices_;
/*_ the number of edges of the solvent exluded surface
*/
Position number_of_edges_;
/*_ the edges of the solvent exluded surface
*/
::std::vector<SESEdge*> edges_;
/*_ the number of singular edges of the solvent exluded surface
*/
Position number_of_singular_edges_;
/*_ the singular edges of the solvent exluded surface
*/
::std::list<SESEdge*> singular_edges_;
/*_ the number of contact faces of the solvent exluded surface
*/
Position number_of_contact_faces_;
/*_ the contact faces of the solvent exluded surface
*/
::std::vector<SESFace*> contact_faces_;
/*_ the number of toric reentrant faces of the solvent exluded surface
*/
Position number_of_toric_faces_;
/*_ the toric reentrant faces of the solvent exluded surface
*/
::std::vector<SESFace*> toric_faces_;
/*_ the number of spheric reentrant faces of the solvent exluded surface
*/
Position number_of_spheric_faces_;
/*_ the spheric reentrant faces of the solvent exluded surface
*/
::std::vector<SESFace*> spheric_faces_;
/*_ the corresponding reduced surface
*/
ReducedSurface* reduced_surface_;
};
BALL_EXPORT std::ostream& operator <<
(std::ostream& s, const SolventExcludedSurface& ses);
class BALL_EXPORT SESComputer
{
public:
BALL_CREATE(SESComputer)
SESComputer()
;
SESComputer(SolventExcludedSurface* ses)
;
virtual ~SESComputer()
;
void run();
private:
/*_ @name SES computation (private)
*/
void preProcessing()
;
void get()
;
void createSphericFace(Position j)
;
SESVertex* createVertex
(const TVector3<double>& probe_center,
Index index)
;
void pushVertex
(SESFace* face,
const TSphere3<double>& probe,
RSVertex* rsvertex)
;
SESEdge* createConcaveEdge
(SESFace* spheric_face,
Position p1,
Position p2,
Index index,
const double& radius_of_probe)
;
void pushConcaveEdge
(SESFace* face,
Position p1,
Position p2,
const double& radius_of_probe)
;
SESEdge* createConvexEdge
(SESFace* toric_face,
RSVertex* rsvertex)
;
void createToricFace(Position i)
;
void treatSingularToricFace(Position i)
;
void createFreeToricFace(Position i)
;
SESVertex* createSingularVertex
(Position ip,
const TVector3<double>& dir,
SESFace* face0,
SESFace* face1,
SESFace* face2,
SESEdge* edge0,
SESEdge* edge1,
SESEdge* edge2)
;
void updateEdge
(SESEdge* edge,
SESVertex* vertex1,
SESVertex* vertex2,
bool is_new)
;
void getPoint
(const TVector3<double>& p1,
const TVector3<double>& p2,
const double& dist,
TVector3<double>& result);
Index vertexExists(const TVector3<double>& point);
protected:
/*_ a pointer to the solvent excluded surface to compute
*/
SolventExcludedSurface* ses_;
/*_ a HashGrid to store and find the vertices in an efficient way
*/
HashGrid3<Index> vertex_grid_;
};
class BALL_EXPORT SESSingularityCleaner
{
public:
BALL_CREATE(SESSingularityCleaner)
typedef std::pair< std::pair<TAngle<double>,Index>,TVector3<double> > Intersection;
struct ProbeIntersection
{
TVector3<double> point[2];
};
friend class SESComputer;
SESSingularityCleaner()
;
SESSingularityCleaner
(SolventExcludedSurface* ses,
HashGrid3<Index>* vertex_grid_)
;
virtual ~SESSingularityCleaner()
;
bool run();
private:
Index vertexExists(TVector3<double> point)
;
void treatSingularities()
;
void getSingularFaces(std::list<SESFace*>& faces)
;
bool treatFirstCategory()
;
void treatSecondCategory()
;
void getFirstCategoryFaces(std::list<SESFace*>& first_category_faces)
;
void noCut(SESFace* face1, SESFace* face2)
;
void twoCuts(SESFace* face1, SESFace* face2)
;
void treatSingularEdge
(SESEdge* edge,
HashGrid3<Position>& grid,
::std::list<SESEdge*>& deletable_edges)
;
void getIntersectionsOfSingularEdge
(SESEdge* edge,
const TAngle<double>& phi,
HashGrid3<Position>& grid,
std::list<Intersection>& intersections)
;
bool getIntersectionPointsAndAngles
(const TCircle3<double>& circle,
const TVector3<double>& point,
Position index1,
Position index2,
Position probe_index,
TAngle<double>& phi1,
TVector3<double>& point1,
TAngle<double>& phi2,
TVector3<double>& point2)
;
bool isIntersection
(const TAngle<double>& min_phi,
const TAngle<double>& max_phi,
const TAngle<double>& phi,
const TVector3<double>& middle,
const TSphere3<double>& probe)
;
void buildEndEdges
(SESEdge* edge,
const std::list<Intersection>& min,
const std::list<Intersection>& max,
SESVertex*& vertex1,
SESVertex*& vertex2,
Index& actual_min,
Index& actual_max)
;
void buildEdge
(SESEdge* edge,
Index face1,
Index& face2,
Index end,
SESVertex*& vertex,
const HashSet<Index>& indices,
bool minimum);
void getExtrema
(const std::list<Intersection>& intersections,
std::list<Intersection>& min,
std::list<Intersection>& max);
void buildEndEdge
(SESEdge* edge,
const std::list<Intersection>& extrema,
SESVertex*& vertex,
Index& actual_extremum,
bool min);
bool probeIntersection
(Index face1,
Index face2,
Index face3,
TVector3<double>& point1,
TVector3<double>& point2);
void sort
(SESFace* face1,
SESFace* face2,
std::vector<SESEdge*>& sesedge1,
std::vector<SESEdge*>& sesedge2,
std::vector<SESVertex*>& sesvertex1,
std::vector<SESVertex*>& sesvertex2);
void sort
(Index u1, Index u2, Index u3,
Index& s1, Index& s2, Index& s3);
protected:
/*_ a pointer to the solvent excluded surface to compute
*/
SolventExcludedSurface* ses_;
/*_ a pointer to a HashGrid to store and find the vertices
in an efficient way
*/
HashGrid3<Index>* vertex_grid_;
/*_ for each triple of probe spheres its intersections
*/
HashMap< Position,
HashMap< Position,
HashMap< Position,
ProbeIntersection*
>
>
> probe_intersections_;
};
} // namespace BALL
#endif // BALL_STRUCTURE_SOLVENTEXCLUDEDSURFACE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
SESEdge.h
SESFace.h
SESVertex.h
angle.h
circle3.h
BALL::HashGrid3
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
BALL::HashMap
HashMap class based on the STL map (containing serveral convenience functions).
Definition hashMap.h:74
BALL::HashSet
Definition hashSet.h:46
BALL::RSVertex
Definition RSVertex.h:38
BALL::ReducedSurface
Definition reducedSurface.h:196
BALL::SESComputer
Definition solventExcludedSurface.h:318
BALL::SESComputer::SESComputer
SESComputer()
BALL::SESComputer::vertex_grid_
HashGrid3< Index > vertex_grid_
Definition solventExcludedSurface.h:447
BALL::SESComputer::ses_
SolventExcludedSurface * ses_
Definition solventExcludedSurface.h:444
BALL::SESComputer::run
void run()
BALL::SESEdge
Definition SESEdge.h:34
BALL::SESFace
Definition SESFace.h:38
BALL::SESSingularityCleaner
Definition solventExcludedSurface.h:457
BALL::SESSingularityCleaner::ses_
SolventExcludedSurface * ses_
Definition solventExcludedSurface.h:626
BALL::SESSingularityCleaner::Intersection
std::pair< std::pair< TAngle< double >, Index >, TVector3< double > > Intersection
Definition solventExcludedSurface.h:462
BALL::SESSingularityCleaner::~SESSingularityCleaner
virtual ~SESSingularityCleaner()
BALL::SESSingularityCleaner::run
bool run()
BALL::SESSingularityCleaner::probe_intersections_
HashMap< Position, HashMap< Position, HashMap< Position, ProbeIntersection * > > > probe_intersections_
Definition solventExcludedSurface.h:639
BALL::SESSingularityCleaner::SESSingularityCleaner
SESSingularityCleaner(SolventExcludedSurface *ses, HashGrid3< Index > *vertex_grid_)
BALL::SESSingularityCleaner::SESComputer
friend class SESComputer
Definition solventExcludedSurface.h:469
BALL::SESSingularityCleaner::SESSingularityCleaner
SESSingularityCleaner()
BALL::SESSingularityCleaner::vertex_grid_
HashGrid3< Index > * vertex_grid_
Definition solventExcludedSurface.h:630
BALL::SESTriangulator
Definition triangulatedSES.h:164
BALL::SESVertex
Definition SESVertex.h:30
BALL::SolventExcludedSurface
Definition solventExcludedSurface.h:67
BALL::SolventExcludedSurface::number_of_edges_
Position number_of_edges_
Definition solventExcludedSurface.h:266
BALL::SolventExcludedSurface::ConstSingularEdgeIterator
std::list< SESEdge * >::const_iterator ConstSingularEdgeIterator
Definition solventExcludedSurface.h:100
BALL::SolventExcludedSurface::SESTriangulator
friend class SESTriangulator
Definition solventExcludedSurface.h:81
BALL::SolventExcludedSurface::beginEdge
ConstEdgeIterator beginEdge() const
BALL::SolventExcludedSurface::endSphericFace
SphericFaceIterator endSphericFace()
BALL::SolventExcludedSurface::endVertex
VertexIterator endVertex()
BALL::SolventExcludedSurface::ConstEdgeIterator
std::vector< SESEdge * >::const_iterator ConstEdgeIterator
Definition solventExcludedSurface.h:96
BALL::SolventExcludedSurface::check
bool check()
BALL::SolventExcludedSurface::clear
void clear()
BALL::SolventExcludedSurface::ConstToricFaceIterator
std::vector< SESFace * >::const_iterator ConstToricFaceIterator
Definition solventExcludedSurface.h:112
BALL::SolventExcludedSurface::endSingularEdge
SingularEdgeIterator endSingularEdge()
BALL::SolventExcludedSurface::ToricFaceIterator
std::vector< SESFace * >::iterator ToricFaceIterator
Definition solventExcludedSurface.h:110
BALL::SolventExcludedSurface::edges_
::std::vector< SESEdge * > edges_
Definition solventExcludedSurface.h:269
BALL::SolventExcludedSurface::SolventExcludedSurface
SolventExcludedSurface(ReducedSurface *reduced_surface)
BALL::SolventExcludedSurface::beginSphericFace
ConstSphericFaceIterator beginSphericFace() const
BALL::SolventExcludedSurface::number_of_vertices_
Position number_of_vertices_
Definition solventExcludedSurface.h:260
BALL::SolventExcludedSurface::beginVertex
VertexIterator beginVertex()
BALL::SolventExcludedSurface::beginVertex
ConstVertexIterator beginVertex() const
BALL::SolventExcludedSurface::ConstVertexIterator
std::vector< SESVertex * >::const_iterator ConstVertexIterator
Definition solventExcludedSurface.h:92
BALL::SolventExcludedSurface::number_of_contact_faces_
Position number_of_contact_faces_
Definition solventExcludedSurface.h:278
BALL::SolventExcludedSurface::reduced_surface_
ReducedSurface * reduced_surface_
Definition solventExcludedSurface.h:296
BALL::SolventExcludedSurface::beginSingularEdge
SingularEdgeIterator beginSingularEdge()
BALL::SolventExcludedSurface::VertexIterator
std::vector< SESVertex * >::iterator VertexIterator
Definition solventExcludedSurface.h:90
BALL::SolventExcludedSurface::SphericFaceIterator
std::vector< SESFace * >::iterator SphericFaceIterator
Definition solventExcludedSurface.h:106
BALL::SolventExcludedSurface::ContactFaceIterator
std::vector< SESFace * >::iterator ContactFaceIterator
Definition solventExcludedSurface.h:102
BALL::SolventExcludedSurface::beginSphericFace
SphericFaceIterator beginSphericFace()
BALL::SolventExcludedSurface::endToricFace
ConstToricFaceIterator endToricFace() const
BALL::SolventExcludedSurface::endContactFace
ConstContactFaceIterator endContactFace() const
BALL::SolventExcludedSurface::singular_edges_
::std::list< SESEdge * > singular_edges_
Definition solventExcludedSurface.h:275
BALL::SolventExcludedSurface::beginContactFace
ContactFaceIterator beginContactFace()
BALL::SolventExcludedSurface::beginToricFace
ToricFaceIterator beginToricFace()
BALL::SolventExcludedSurface::beginContactFace
ConstContactFaceIterator beginContactFace() const
BALL::SolventExcludedSurface::spheric_faces_
::std::vector< SESFace * > spheric_faces_
Definition solventExcludedSurface.h:293
BALL::SolventExcludedSurface::endEdge
EdgeIterator endEdge()
BALL::SolventExcludedSurface::TriangulatedSES
friend class TriangulatedSES
Definition solventExcludedSurface.h:80
BALL::SolventExcludedSurface::ConstContactFaceIterator
std::vector< SESFace * >::const_iterator ConstContactFaceIterator
Definition solventExcludedSurface.h:104
BALL::SolventExcludedSurface::beginSingularEdge
ConstSingularEdgeIterator beginSingularEdge() const
BALL::SolventExcludedSurface::endToricFace
ToricFaceIterator endToricFace()
BALL::SolventExcludedSurface::ConstSphericFaceIterator
std::vector< SESFace * >::const_iterator ConstSphericFaceIterator
Definition solventExcludedSurface.h:108
BALL::SolventExcludedSurface::toric_faces_
::std::vector< SESFace * > toric_faces_
Definition solventExcludedSurface.h:287
BALL::SolventExcludedSurface::~SolventExcludedSurface
virtual ~SolventExcludedSurface()
BALL::SolventExcludedSurface::SESSingularityCleaner
friend class SESSingularityCleaner
Definition solventExcludedSurface.h:79
BALL::SolventExcludedSurface::number_of_spheric_faces_
Position number_of_spheric_faces_
Definition solventExcludedSurface.h:290
BALL::SolventExcludedSurface::EdgeIterator
std::vector< SESEdge * >::iterator EdgeIterator
Definition solventExcludedSurface.h:94
BALL::SolventExcludedSurface::number_of_toric_faces_
Position number_of_toric_faces_
Definition solventExcludedSurface.h:284
BALL::SolventExcludedSurface::compute
void compute()
BALL::SolventExcludedSurface::beginEdge
EdgeIterator beginEdge()
BALL::SolventExcludedSurface::endContactFace
ContactFaceIterator endContactFace()
BALL::SolventExcludedSurface::endSingularEdge
ConstSingularEdgeIterator endSingularEdge() const
BALL::SolventExcludedSurface::splitSphericFaces
void splitSphericFaces()
BALL::SolventExcludedSurface::vertices_
::std::vector< SESVertex * > vertices_
Definition solventExcludedSurface.h:263
BALL::SolventExcludedSurface::contact_faces_
::std::vector< SESFace * > contact_faces_
Definition solventExcludedSurface.h:281
BALL::SolventExcludedSurface::SESComputer
friend class SESComputer
Definition solventExcludedSurface.h:78
BALL::SolventExcludedSurface::endVertex
ConstVertexIterator endVertex() const
BALL::SolventExcludedSurface::number_of_singular_edges_
Position number_of_singular_edges_
Definition solventExcludedSurface.h:272
BALL::SolventExcludedSurface::endEdge
ConstEdgeIterator endEdge() const
BALL::SolventExcludedSurface::SingularEdgeIterator
std::list< SESEdge * >::iterator SingularEdgeIterator
Definition solventExcludedSurface.h:98
BALL::SolventExcludedSurface::SolventExcludedSurface
SolventExcludedSurface(const SolventExcludedSurface &ses, bool=false)
BALL::SolventExcludedSurface::endSphericFace
ConstSphericFaceIterator endSphericFace() const
BALL::SolventExcludedSurface::SolventExcludedSurface
SolventExcludedSurface()
BALL::SolventExcludedSurface::clean
void clean(const double &density)
BALL::SolventExcludedSurface::beginToricFace
ConstToricFaceIterator beginToricFace() const
BALL::TAngle
Definition angle.h:53
BALL::TCircle3
Definition circle3.h:46
BALL::TSphere3
Definition sphere3.h:33
BALL::TVector3
Definition vector3.h:71
BALL::TriangulatedSES
Definition triangulatedSES.h:55
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
hashGrid.h
hashMap.h
BALL
Definition constants.h:13
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
std
STL namespace.
reducedSurface.h
sphere3.h
BALL::SESSingularityCleaner::ProbeIntersection
Definition solventExcludedSurface.h:465
BALL::SESSingularityCleaner::ProbeIntersection::point
TVector3< double > point[2]
Definition solventExcludedSurface.h:466
vector3.h
vector4.h