1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2003-2011 by The University of Queensland //
// Earth Systems Science Computational Centre (ESSCC) //
// http://www.uq.edu.au/esscc //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.opensource.org/licenses/osl-3.0.php //
// //
/////////////////////////////////////////////////////////////
#ifndef ESYS_LSMGOUGEBLOCK3D_H
#define ESYS_LSMGOUGEBLOCK3D_H
#include "Foundation/BoundingBox.h"
#include "Geometry/CircularNeighbourTable.h"
#include "Geometry/BlockGenerator.h"
#include "Geometry/Plane.h"
#include "Geometry/BasicInteraction.h"
#include <boost/shared_ptr.hpp>
#include <vector>
#include <float.h>
namespace esys
{
namespace lsm
{
typedef std::vector<Plane> PlaneVector;
enum Orientation
{
XY,
XZ,
YZ
};
class ParticleBlockPrms
{
public:
ParticleBlockPrms();
ParticleBlockPrms(double size, double minRadius, double maxRadius);
~ParticleBlockPrms();
double m_size;
double m_minRadius;
double m_maxRadius;
};
typedef std::vector<bool> BoolVector;
typedef std::vector<BoundingBox> BoundingBoxVector;
class PackingInfo
{
public:
PackingInfo(
const BoundingBox &bBox,
const BoolVector &periodicDimensions,
Orientation orientation,
double minRadius,
double maxRadius
);
bool is3d() const;
void initialiseFitPlaneVector();
const BoundingBox &getBBox() const;
const PlaneVector &getFitPlaneVector() const;
double getMinRadius() const;
double getMaxRadius() const;
const BoolVector &getPeriodicDimensions() const;
private:
BoundingBox m_bBox;
BoolVector m_periodicDimensions;
Orientation m_orientation;
double m_minRadius;
double m_maxRadius;
PlaneVector m_fitPlaneVector;
};
typedef std::vector<PackingInfo> PackingInfoVector;
class GougeBlockPrms
{
public:
GougeBlockPrms();
/**
*
*/
GougeBlockPrms(
const BoundingBox &bBox,
double padRadius,
Orientation orientation,
const ParticleBlockPrms &faultRegionPrms,
const ParticleBlockPrms &gougeRegionPrms,
const BoolVector &peridicDimensions=BoolVector(3, false),
int maxInsertionFailures=100,
double tolerance = DBL_EPSILON*128,
double connectionTolerance = DBL_EPSILON*128*10
);
~GougeBlockPrms();
double getTolerance() const;
double getConnectionTolerance() const;
const BoundingBox &getBBox() const;
int getMaxInsertionFailures() const;
double getRegularBlockRadius() const;
double getFaultMinRadius() const;
double getFaultMaxRadius() const;
double getGougeMinRadius() const;
double getGougeMaxRadius() const;
const BoolVector &getPeriodicDimensions() const;
BoundingBoxVector getRegularBBoxVector() const;
PackingInfoVector getGougePackingInfoVector() const;
PackingInfoVector getFaultPackingInfoVector() const;
BoundingBox cutFromCentre(double d1, double d2) const;
Orientation getOrientation() const;
int getOrientationIndex() const;
double getOrientationSize() const;
double getMaxRadius() const;
double getMinRadius() const;
bool is2d() const;
private:
BoundingBox m_bBox;
double m_padRadius;
Orientation m_orientation;
ParticleBlockPrms m_faultPrms;
ParticleBlockPrms m_gougePrms;
BoolVector m_periodicDimensions;
int m_maxInsertionFailures;
double m_tolerance;
double m_connectionTolerance;
};
/*!
\class GougeBlock3D
\brief Block consisting of regular padding, random layer and gouge
*/
class GougeBlock3D
{
public:
typedef SimpleParticle Particle;
GougeBlock3D(const GougeBlockPrms &prms);
virtual ~GougeBlock3D();
virtual void generate();
int getNumParticles() const;
typedef CircularNeighbourTable<SimpleParticle> NTable;
typedef boost::shared_ptr<NTable> NTablePtr;
typedef boost::shared_ptr<BlockGenerator> GeneratorPtr;
typedef std::vector<GeneratorPtr> GeneratorPtrVector;
typedef NTable::ParticlePool ParticlePool;
typedef NTable::ParticlePoolPtr ParticlePoolPtr;
const GeneratorPtrVector &getGougeGeneratorVector() const;
const GeneratorPtrVector &getFaultGeneratorVector() const;
bool isGougeParticle(const SimpleParticle &particle) const;
bool areInDifferentFaultBlocks(
const SimpleParticle &p1,
const SimpleParticle &p2
) const;
virtual void write(std::ostream &oStream) const;
void writeToFile(const std::string &fileName) const;
void tagGougeParticles(int tag);
void tagFaultParticles(int tag);
void tagDrivingPlateParticles(
int minDrivingTag,
int maxDrivingTag,
double distanceFromBBoxEdge
);
typedef std::set<BasicInteraction,BILess> InteractionSet;
virtual void createInteractionSet();
const InteractionSet &getInteractionSet() const;
template <typename TmplVisitor>
void visitParticles(TmplVisitor &visitor)
{
for (
GeneratorPtrVector::iterator it = m_genPtrVector.begin();
it != m_genPtrVector.end();
it++
)
{
BlockGenerator::ParticleIterator particleIt = (*it)->getParticleIterator();
while (particleIt.hasNext()) {
particleIt.next()->visit(visitor);
}
}
}
template <typename TmplVisitor>
void visitParticles(const TmplVisitor &visitor) const
{
for (
GeneratorPtrVector::const_iterator it = m_genPtrVector.begin();
it != m_genPtrVector.end();
it++
)
{
BlockGenerator::ParticleIterator particleIt = (*it)->getParticleIterator();
while (particleIt.hasNext()) {
particleIt.next()->visit(visitor);
}
}
}
template <typename TmplVisitor>
void visitInteractions(TmplVisitor &visitor) const
{
const InteractionSet &interactionSet = getInteractionSet();
for (
InteractionSet::const_iterator it = interactionSet.begin();
it != interactionSet.end();
it++
)
{
it->visit(visitor);
}
}
const GougeBlockPrms &getPrms() const
{
return m_prms;
}
protected:
NTablePtr m_nTablePtr;
GougeBlockPrms m_prms;
InteractionSet m_interactionSet;
GeneratorPtrVector m_gougeGenPtrVector;
GeneratorPtrVector m_genPtrVector;
ParticlePoolPtr m_particlePoolPtr;
void createRegularBlockGenerators();
void createFaultBlockGenerators();
virtual void createGougeBlockGenerators();
private:
GeneratorPtrVector m_regularGenPtrVector;
GeneratorPtrVector m_faultGenPtrVector;
};
};
};
#endif
|