| 1 | /* |
| 2 | * MoleculesToTriangles/CXXSurface/CXXSurface.h |
| 3 | * |
| 4 | * Copyright 2009 by Martin Noble, University of Oxford |
| 5 | * Author: Martin Noble |
| 6 | * |
| 7 | * This file is part of Coot |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU Lesser General Public License as published |
| 11 | * by the Free Software Foundation; either version 3 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 22 | * 02110-1301, USA |
| 23 | */ |
| 24 | #ifndef CXXSurface_included |
| 25 | #define CXXSurface_includedcxx . . $ `MoleculesToTriangles/CXXSurface/CXXSurface.h:25:9`! |
| 26 | #include <string> |
| 27 | #include <vector> |
| 28 | #include <map> |
| 29 | #include <iostream> |
| 30 | #include <fstream> |
| 31 | #ifndef __MMDB_Manager__cxx . . $ `<external>/4178908375504615306/mmdb_manager.h:42:9`! |
| 32 | #include "mmdb2/mmdb_manager.h" |
| 33 | #endif |
| 34 | |
| 35 | using namespace std; |
| 36 | |
| 37 | class CXXSphereElementcxx . . $ CXXSphereElement#; |
| 38 | class CXXTorusElementcxx . . $ CXXTorusElement#; |
| 39 | #include "CXXTriangle.h"cxx . . $ `<file>/MoleculesToTriangles/CXXSurface/CXXTriangle.h`/ |
| 40 | #include "CXXCoord.h"cxx . . $ `<file>/MoleculesToTriangles/CXXSurface/CXXCoord.h`/ |
| 41 | |
| 42 | class SurfaceParameterscxx . . $ SurfaceParameters#{ |
| 43 | public: |
| 44 | size_t nVerticescxx . . $ SurfaceParameters#nVertices.; |
| 45 | size_t nTrianglescxx . . $ SurfaceParameters#nTriangles.; |
| 46 | double MSAcxx . . $ SurfaceParameters#MSA.; |
| 47 | double ASAcxx . . $ SurfaceParameters#ASA.; |
| 48 | stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> pMinscxx . . $ SurfaceParameters#pMins.; |
| 49 | stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> pMaxescxx . . $ SurfaceParameters#pMaxes.; |
| 50 | stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, double> pMeanscxx . . $ SurfaceParameters#pMeans.; |
| 51 | |
| 52 | SurfaceParameterscxx . . $ SurfaceParameters#SurfaceParameters(49f6e7a06ebc5aa8).() : nVerticescxx . . $ SurfaceParameters#nVertices.(0), nTrianglescxx . . $ SurfaceParameters#nTriangles.(0), MSAcxx . . $ SurfaceParameters#MSA.(0.),ASAcxx . . $ SurfaceParameters#ASA.(0.){}; |
| 53 | SurfaceParameterscxx . . $ SurfaceParameters#& operatorcxx . . $ SurfaceParameters#`operator+=`(c84971ea638bcbdf). += (const SurfaceParameterscxx . . $ SurfaceParameters# &otherParameters){ |
| 54 | MSAcxx . . $ SurfaceParameters#MSA. += otherParameters.MSAcxx . . $ SurfaceParameters#MSA.; |
| 55 | ASAcxx . . $ SurfaceParameters#ASA. += otherParameters.ASAcxx . . $ SurfaceParameters#ASA.; |
| 56 | for (stdcxx . . $ std/::mapcxx . . $ std/map#<std::string,double>::const_iteratorcxx . . $ std/map#const_iterator# prop=otherParameters.pMinscxx . . $ SurfaceParameters#pMins..begincxx . . $ std/map#begin(b953fec338ad1a3b).(); |
| 57 | prop!=otherParameters.pMinscxx . . $ SurfaceParameters#pMins..endcxx . . $ std/map#end(b953fec338ad1a3b).(); prop++cxx . . $ std/_Rb_tree_const_iterator#operator++(bc8647ccc78a993a).){ |
| 58 | if (pMinscxx . . $ SurfaceParameters#pMins..findcxx . . $ std/map#find(36f8d56706583706).(prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.)!=pMinscxx . . $ SurfaceParameters#pMins..endcxx . . $ std/map#end(7e4de33083b6e738).()) pMinscxx . . $ SurfaceParameters#pMins.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = mincxx . . $ std/min(2a338fce5842aa6a).(pMinscxx . . $ SurfaceParameters#pMins.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.], prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.); |
| 59 | else pMinscxx . . $ SurfaceParameters#pMins.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.; |
| 60 | } |
| 61 | for (stdcxx . . $ std/::mapcxx . . $ std/map#<std::string,double>::const_iteratorcxx . . $ std/map#const_iterator# prop=otherParameters.pMaxescxx . . $ SurfaceParameters#pMaxes..begincxx . . $ std/map#begin(b953fec338ad1a3b).(); |
| 62 | prop!=otherParameters.pMaxescxx . . $ SurfaceParameters#pMaxes..endcxx . . $ std/map#end(b953fec338ad1a3b).(); prop++cxx . . $ std/_Rb_tree_const_iterator#operator++(bc8647ccc78a993a).){ |
| 63 | if (pMaxescxx . . $ SurfaceParameters#pMaxes..findcxx . . $ std/map#find(36f8d56706583706).(prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.)!=pMaxescxx . . $ SurfaceParameters#pMaxes..endcxx . . $ std/map#end(7e4de33083b6e738).()) pMaxescxx . . $ SurfaceParameters#pMaxes.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = maxcxx . . $ std/max(2a338fce5842aa6a).(pMaxescxx . . $ SurfaceParameters#pMaxes.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.], prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.); |
| 64 | else pMaxescxx . . $ SurfaceParameters#pMaxes.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.; |
| 65 | } |
| 66 | for (stdcxx . . $ std/::mapcxx . . $ std/map#<std::string,double>::const_iteratorcxx . . $ std/map#const_iterator# prop=otherParameters.pMeanscxx . . $ SurfaceParameters#pMeans..begincxx . . $ std/map#begin(b953fec338ad1a3b).(); |
| 67 | prop!=otherParameters.pMeanscxx . . $ SurfaceParameters#pMeans..endcxx . . $ std/map#end(b953fec338ad1a3b).(); prop++cxx . . $ std/_Rb_tree_const_iterator#operator++(bc8647ccc78a993a).){ |
| 68 | if (pMeanscxx . . $ SurfaceParameters#pMeans..findcxx . . $ std/map#find(36f8d56706583706).(prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.)!=pMeanscxx . . $ SurfaceParameters#pMeans..endcxx . . $ std/map#end(7e4de33083b6e738).()) { |
| 69 | pMeanscxx . . $ SurfaceParameters#pMeans.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = (pMeanscxx . . $ SurfaceParameters#pMeans.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] + prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.) / (nVerticescxx . . $ SurfaceParameters#nVertices. + otherParameters.nVerticescxx . . $ SurfaceParameters#nVertices.); |
| 70 | } |
| 71 | else pMeanscxx . . $ SurfaceParameters#pMeans.[cxx . . $ std/map#`operator[]`(bbd415b616967878).prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).firstcxx . . $ std/pair#first.] = prop->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.; |
| 72 | } |
| 73 | nTrianglescxx . . $ SurfaceParameters#nTriangles. += otherParameters.nTrianglescxx . . $ SurfaceParameters#nTriangles.; |
| 74 | nVerticescxx . . $ SurfaceParameters#nVertices. += otherParameters.nVerticescxx . . $ SurfaceParameters#nVertices.; |
| 75 | return *this; |
| 76 | }; |
| 77 | }; |
| 78 | |
| 79 | |
| 80 | typedef mapcxx . . $ std/map#<stringcxx . . $ std/string#, size_t> StringIntMapcxx . . $ StringIntMap#; |
| 81 | class CXXSurfacecxx . . $ CXXSurface#{ |
| 82 | private: |
| 83 | stringcxx . . $ std/string# namecxx . . $ CXXSurface#name.; |
| 84 | StringIntMapcxx . . $ StringIntMap# vectorscxx . . $ CXXSurface#vectors.; |
| 85 | StringIntMapcxx . . $ StringIntMap# scalarscxx . . $ CXXSurface#scalars.; |
| 86 | StringIntMapcxx . . $ StringIntMap# pointerscxx . . $ CXXSurface#pointers.; |
| 87 | vectorcxx . . $ std/vector#<CXXTrianglecxx . . $ CXXTriangle# > trianglescxx . . $ CXXSurface#triangles.; |
| 88 | vectorcxx . . $ std/vector#<CXXSurfaceVertexcxx . . $ CXXSurfaceVertex#> verticescxx . . $ CXXSurface#vertices.; |
| 89 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#* allAtomsManagercxx . . $ CXXSurface#allAtomsManager.; |
| 90 | int initcxx . . $ CXXSurface#init(b126dc7c1de90089).(); |
| 91 | size_t nTrianglescxx . . $ CXXSurface#nTriangles.; |
| 92 | char fileNamecxx . . $ CXXSurface#fileName.[512]; |
| 93 | public: |
| 94 | stdcxx . . $ std/::stringcxx . . $ std/string# reportcxx . . $ CXXSurface#report(efd28698952f529a).(); |
| 95 | int writeAsGraspcxx . . $ CXXSurface#writeAsGrasp(89800cbf2a9b278f).(stringcxx . . $ std/string# path); |
| 96 | int readGraspFilecxx . . $ CXXSurface#readGraspFile(89800cbf2a9b278f).(stdcxx . . $ std/::stringcxx . . $ std/string# fileName); |
| 97 | |
| 98 | const vectorcxx . . $ std/vector#<CXXTrianglecxx . . $ CXXTriangle# >&getTrianglescxx . . $ CXXSurface#getTriangles(bb262373fc531b3f).() const { |
| 99 | return trianglescxx . . $ CXXSurface#triangles.; |
| 100 | }; |
| 101 | const vectorcxx . . $ std/vector#<CXXSurfaceVertexcxx . . $ CXXSurfaceVertex#>&getVerticescxx . . $ CXXSurface#getVertices(d8fcfeef922db646).() const { |
| 102 | return verticescxx . . $ CXXSurface#vertices.; |
| 103 | }; |
| 104 | const StringIntMapcxx . . $ StringIntMap# &vectorNamescxx . . $ CXXSurface#vectorNames(364e694a406817d).() const{ |
| 105 | return vectorscxx . . $ CXXSurface#vectors.; |
| 106 | }; |
| 107 | const StringIntMapcxx . . $ StringIntMap# &scalarNamescxx . . $ CXXSurface#scalarNames(364e694a406817d).() const{ |
| 108 | return scalarscxx . . $ CXXSurface#scalars.; |
| 109 | }; |
| 110 | const StringIntMapcxx . . $ StringIntMap# &pointerNamescxx . . $ CXXSurface#pointerNames(364e694a406817d).() const{ |
| 111 | return pointerscxx . . $ CXXSurface#pointers.; |
| 112 | }; |
| 113 | |
| 114 | const CXXCoordcxx . . $ CXXCoord#<CXXCoord_ftypecxx . . $ CXXCoord_ftype#>&coordRefcxx . . $ CXXSurface#coordRef(14cae7f1d9136c4).(size_t coordType, size_t iTriangle, size_t corner) const; |
| 115 | const CXXCoordcxx . . $ CXXCoord#<CXXCoord_ftypecxx . . $ CXXCoord_ftype#>&coordRefcxx . . $ CXXSurface#coordRef(c042d6d638840454).(size_t coordType, size_t iVertex) const; |
| 116 | int getCoordcxx . . $ CXXSurface#getCoord(ebfd0b66524d5a98).(const stringcxx . . $ std/string# &type, const size_t iTriangle, const size_t corner, double *buffer); |
| 117 | int getCoordcxx . . $ CXXSurface#getCoord(4b0c9c5490b6bbef).(const stringcxx . . $ std/string# &type, const size_t iVertex, double *buffer); |
| 118 | int getCoordcxx . . $ CXXSurface#getCoord(8ccbf8ebcc5dd0a8).(const size_t handle, const size_t iVertex, double *buffer); |
| 119 | int getPointercxx . . $ CXXSurface#getPointer(dc474833a6c203a8).(const stringcxx . . $ std/string# &type, size_t iVertex, void **return_p); |
| 120 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#* getMMDBManagercxx . . $ CXXSurface#getMMDBManager(6b2d30ba321e06d6).() const; |
| 121 | size_t setCoordcxx . . $ CXXSurface#setCoord(c4aaa4b0d3e56668). (const stringcxx . . $ std/string# &type, size_t iVertex, const CXXCoordcxx . . $ CXXCoord#<CXXCoord_ftypecxx . . $ CXXCoord_ftype#>&crd); |
| 122 | void setScalarcxx . . $ CXXSurface#setScalar(9150982b2f729752). (size_t scalarHandle, size_t iVertex, double &value); |
| 123 | void setScalarcxx . . $ CXXSurface#setScalar(cb43e0fe79ab174c). (const stdcxx . . $ std/::stringcxx . . $ std/string# name, size_t iVertex, double &value); |
| 124 | |
| 125 | int addPerVertexVectorcxx . . $ CXXSurface#addPerVertexVector(d89106a8d4fc1474). (const stringcxx . . $ std/string# name, double *vectorBuffer); |
| 126 | int addPerVertexScalarcxx . . $ CXXSurface#addPerVertexScalar(d89106a8d4fc1474). (const stringcxx . . $ std/string# name, double *scalarBuffer); |
| 127 | int addPerVertexPointercxx . . $ CXXSurface#addPerVertexPointer(f1728a0f22163624). (const stringcxx . . $ std/string# name, void **pointerBuffer); |
| 128 | |
| 129 | size_t extendWithVectorDatacxx . . $ CXXSurface#extendWithVectorData(b33fe5f23c9b31a4).(size_t count, const stringcxx . . $ std/string# name, double *vectorBuffer); |
| 130 | size_t updateWithVectorDatacxx . . $ CXXSurface#updateWithVectorData(7938fb2fbf78fb52).(size_t count, const stringcxx . . $ std/string# name, size_t start, double *data); |
| 131 | size_t updateWithPointerDatacxx . . $ CXXSurface#updateWithPointerData(54967c509bd16209).(size_t count, const stringcxx . . $ std/string# name, size_t start, void **data); |
| 132 | size_t extendTrianglescxx . . $ CXXSurface#extendTriangles(8eff909a04c29d16).(int *triangleBuffer, int count); |
| 133 | |
| 134 | |
| 135 | size_t numberOfTrianglescxx . . $ CXXSurface#numberOfTriangles(fe4d2d262d4164a8).() const; |
| 136 | size_t numberOfVerticescxx . . $ CXXSurface#numberOfVertices(fe4d2d262d4164a8).() const; |
| 137 | |
| 138 | size_t vertexcxx . . $ CXXSurface#vertex(1514433e0e383e16).(size_t iTriangle, size_t iCorner) const; |
| 139 | |
| 140 | int upLoadSpherecxx . . $ CXXSurface#upLoadSphere(d1fab6f2372fbe9).(CXXSphereElementcxx . . $ CXXSphereElement# &theSphere, double probeRadius, const int sense); |
| 141 | int uploadToruscxx . . $ CXXSurface#uploadTorus(78a6937bec40ac29).(CXXTorusElementcxx . . $ CXXTorusElement# &theTorus); |
| 142 | int selectionStringToSelHndcxx . . $ CXXSurface#selectionStringToSelHnd(27a2bc5365de8eed).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#*, const stdcxx . . $ std/::stringcxx . . $ std/string# selectionString); |
| 143 | int getIntegerUDDataOfAtomcxx . . $ CXXSurface#getIntegerUDDataOfAtom(e2afdcaa68bde9a7).(mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom#* theAtom, int handle); |
| 144 | int operatorcxx . . $ CXXSurface#`operator==`(52bdb2f45fdff6f9). == (const CXXSurfacecxx . . $ CXXSurface# &comparator) const{ |
| 145 | return (this == &comparator); |
| 146 | } |
| 147 | size_t getVectorHandlecxx . . $ CXXSurface#getVectorHandle(88066e8f375b3fae).(const stringcxx . . $ std/string# name); |
| 148 | size_t getReadVectorHandlecxx . . $ CXXSurface#getReadVectorHandle(88066e8f375b3fae).(const stringcxx . . $ std/string# name); |
| 149 | size_t getScalarHandlecxx . . $ CXXSurface#getScalarHandle(88066e8f375b3fae).(const stringcxx . . $ std/string# name); |
| 150 | size_t getReadScalarHandlecxx . . $ CXXSurface#getReadScalarHandle(88066e8f375b3fae).(const stringcxx . . $ std/string# name); |
| 151 | size_t getPointerHandlecxx . . $ CXXSurface#getPointerHandle(88066e8f375b3fae).(const stringcxx . . $ std/string# name); |
| 152 | |
| 153 | int getScalarcxx . . $ CXXSurface#getScalar(8b88f8f6e0973d2d).(int handle, int iVertex, double &result); |
| 154 | int getVectorcxx . . $ CXXSurface#getVector(efa459c30319585d).(int handle, int iVertex, double *result); |
| 155 | |
| 156 | int addTrianglecxx . . $ CXXSurface#addTriangle(c7fc115fac3164b6).(const CXXTrianglecxx . . $ CXXTriangle# &aTriangle); |
| 157 | |
| 158 | int assignUnitedAtomRadiuscxx . . $ CXXSurface#assignUnitedAtomRadius(b126dc7c1de90089).(); |
| 159 | |
| 160 | void compresscxx . . $ CXXSurface#compress(ba8836b59fb42830).(double tolerance); |
| 161 | SurfaceParameterscxx . . $ SurfaceParameters# measuredPropertiescxx . . $ CXXSurface#measuredProperties(1fc4e273a0ed118a).(); |
| 162 | |
| 163 | int assignAtomcxx . . $ CXXSurface#assignAtom(610ca1e20caf89dd).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#*, int); |
| 164 | int colorByAssignedAtomcxx . . $ CXXSurface#colorByAssignedAtom(b126dc7c1de90089).(); |
| 165 | int colorByColourArraycxx . . $ CXXSurface#colorByColourArray(ad194377b0d24001).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<double*> &colours, mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager#* molHnd, int selHnd); |
| 166 | |
| 167 | void appendSurfacecxx . . $ CXXSurface#appendSurface(4739e7098e0212ff).(const CXXSurfacecxx . . $ CXXSurface# &otherSurface); |
| 168 | |
| 169 | |
| 170 | }; |
| 171 | |
| 172 | #endif |
| 173 | |
| 174 | |
| 175 | |
| 176 |