OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::ParticleTopologyDescription Class Reference

A grid based particle method for describing topology. More...

#include <particletopologydescription.h>

+ Inheritance diagram for oofem::ParticleTopologyDescription:
+ Collaboration diagram for oofem::ParticleTopologyDescription:

Public Member Functions

 ParticleTopologyDescription (Domain *d)
 
virtual ~ParticleTopologyDescription ()
 
virtual bool instanciateYourself (DataReader &dr)
 Instanciates itself. More...
 
virtual TopologyState updateYourself (TimeStep *tStep)
 Updates the topology from the FE solution. More...
 
virtual void generateMesh (std::vector< FloatArray > &nodes, std::vector< IntArray > &elements, std::vector< IntArray > &segments, std::vector< IntArray > &n_markers, IntArray &e_markers, IntArray &s_markers, IntArray &e_egt, IntArray &s_egt)
 Generates a mesh from the topology. More...
 
virtual void replaceFEMesh ()
 Generates the FE components from the bare mesh. More...
 
virtual void doOutput (TimeStep *tStep)
 File output of the current state of the topology description. More...
 
virtual void writeDataToFile (const char *name) const
 
virtual void writeVTKFile (const char *name) const
 
virtual const char * giveClassName () const
 Gives the name of the class. More...
 
- Public Member Functions inherited from oofem::TopologyDescription
 TopologyDescription (Domain *d)
 
virtual ~TopologyDescription ()
 
virtual void setDomain (Domain *newDomain)
 Changes the connected domain of receiver. More...
 
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros). More...
 

Protected Member Functions

void resample ()
 Resamples the grid. More...
 
TopologyState checkOverlap ()
 Deactivates points with inconsistent information. More...
 
void removePoints (ParticleGrid< ParticlePoint > &g) const
 Clears all points marked for removal. More...
 
bool findDisplacement (FloatArray &answer, int id, const FloatArray &footpoint, TimeStep *tStep) const
 Finds the displacement for the underlying FE-mesh. More...
 
void collectNeighbors (std::list< ParticlePoint * > &answer, const ParticlePoint *p, double dist=0) const
 Collects neighboring points according to some specification. More...
 
void calculateShortestDistance (const ParticlePoint *p, std::list< ParticlePoint * > &points, ParticleGrid< ParticlePoint > &grid) const
 Shortest distance from least square fit based on 2nd order polynomial. More...
 
double shortestDistanceFromCurve (const FloatArray &a, double txi_min, double txi_max, const FloatArray &n0, const FloatArray &y0, const FloatArray &p, FloatArray &foot, FloatArray &normal) const
 Helper for calculateShortestDistance. More...
 
void addLineSegment (int id, const FloatArray &p0, const FloatArray &p1, ParticleGrid< ParticlePoint > &grid) const
 Used for initialization, calculating the distance from primitives. More...
 
void addCircleSegment (int id, const FloatArray &c, double r, double v0, double v1, ParticleGrid< ParticlePoint > &grid) const
 Used for initialization, calculating the distance from primitives. More...
 
void addCorner (int id, const FloatArray &c, ParticleGrid< ParticlePoint > &grid)
 Adds a corner node. More...
 
void generatePSLG (Triangle_PSLG &PSLG)
 Generates the PSLG for meshing with Triangle. More...
 

Static Protected Member Functions

static void getBoundingBox (FloatArray &x0, FloatArray &x1, const FloatArray &c, double width)
 Helper for common task of fetching a bounding box around a point. More...
 

Protected Attributes

bool useDisplacements
 Determines if velocity or displacements dofs should be used to update geometry. More...
 
bool writeVTK
 Conditional for printing VTK output. More...
 
bool resampled
 Denotes if the active grid is newly resampled. More...
 
double maxdisp2
 Maximum squared displacement of any particle. More...
 
double tubeWidth
 Width of the tube around the interfaces. More...
 
int m
 Number of points to use for resampling. More...
 
std::unique_ptr< ParticleGrid< ParticlePoint > > grid
 The grid of points, the actual topological information. More...
 
std::list< ParticlePointcorners
 Corner nodes. More...
 
IntArray regionOutside
 Mapping of regions from delimited by each id. More...
 
IntArray regionInside
 
FloatMatrix mergeID
 
FloatMatrix controlID
 
std::vector< std::string > regionElementType
 Mapping from region to FE components. More...
 
IntArray regionSet
 
- Protected Attributes inherited from oofem::TopologyDescription
Domaind
 Domain which topology belongs to. More...
 

Detailed Description

A grid based particle method for describing topology.

Based on papers: Shingyu Leung and Hongkai Zhao, A Grid Based Particle Method for Evolution of Open Curves and Surfaces. Journal of Computational Physics, Volume 228, Issue 20, November 1 2009, Pages 7706-7728. Shingyu Leung and Hongkai Zhao, A Grid Based Particle Method for Moving Interface Problems. UCLA-CAM 08-08. Journal of Computational Physics, Volume 228, Issue 8, May 1 2009, Pages 2993-3024. with some modifications and missing implementations.

Note
Experimental! Both inconvenient to use, and not very robust.
Todo:

Absolutely vital is the use of adaptivity, which is not yet implemented.

Merging of regions is still lacking.

Vanishing pores occasionally experience problems.

Partial reconstruction should be possible.

Author
Mikael Öhman

Definition at line 129 of file particletopologydescription.h.

Constructor & Destructor Documentation

oofem::ParticleTopologyDescription::ParticleTopologyDescription ( Domain d)

Definition at line 77 of file particletopologydescription.C.

oofem::ParticleTopologyDescription::~ParticleTopologyDescription ( )
virtual

Definition at line 80 of file particletopologydescription.C.

References corners.

Member Function Documentation

void oofem::ParticleTopologyDescription::addCircleSegment ( int  id,
const FloatArray c,
double  r,
double  v0,
double  v1,
ParticleGrid< ParticlePoint > &  grid 
) const
protected

Used for initialization, calculating the distance from primitives.

Adds a circle segment from p0 to p1, with center at c.

Parameters
idID for segment.
cCenter coordinate.
rRadius.
v0Lower angle [-pi,pi].
v1Upper angle [-pi,pi].
gridGrid to add points to.

Definition at line 218 of file particletopologydescription.C.

References oofem::ParticlePoint::distance2, oofem::FloatArray::distance_square(), getBoundingBox(), grid, and tubeWidth.

Referenced by instanciateYourself().

void oofem::ParticleTopologyDescription::addCorner ( int  id,
const FloatArray c,
ParticleGrid< ParticlePoint > &  grid 
)
protected

Adds a corner node.

Parameters
idID for corner.
cCoordinate of corner.
gridGrid to add corner to.
Todo:
Remove this structure.

Definition at line 256 of file particletopologydescription.C.

References oofem::ParticleGrid< Point >::beginAt(), oofem::ParticlePoint::corner, corners, oofem::FloatArray::distance_square(), oofem::ParticlePoint::foot, getBoundingBox(), oofem::FloatArray::giveSize(), oofem::ParticlePoint::id, and tubeWidth.

Referenced by instanciateYourself().

void oofem::ParticleTopologyDescription::addLineSegment ( int  id,
const FloatArray p0,
const FloatArray p1,
ParticleGrid< ParticlePoint > &  grid 
) const
protected

Used for initialization, calculating the distance from primitives.

Adds line segment from p0 to p1.

Parameters
idID for segment.
p0First corner of the edge.
p1Second corner of the edge.
gridGrid to add points to.

Definition at line 171 of file particletopologydescription.C.

References oofem::FloatArray::add(), oofem::FloatArray::beDifferenceOf(), oofem::FloatArray::beMaxOf(), oofem::FloatArray::beMinOf(), oofem::FloatArray::computeNorm(), oofem::ParticlePoint::distance2, oofem::FloatArray::distance_square(), oofem::FloatArray::dotProduct(), grid, oofem::FloatArray::times(), and tubeWidth.

Referenced by instanciateYourself().

void oofem::ParticleTopologyDescription::calculateShortestDistance ( const ParticlePoint p,
std::list< ParticlePoint * > &  points,
ParticleGrid< ParticlePoint > &  grid 
) const
protected
void oofem::ParticleTopologyDescription::collectNeighbors ( std::list< ParticlePoint * > &  answer,
const ParticlePoint p,
double  dist = 0 
) const
protected

Collects neighboring points according to some specification.

Finds a maximum of around m neighbors, could be fewer. A optional distance can be added to take into account the displaced foot points.

Parameters
answerThe neighboring particles.
pPoint to compute neighbors around.
distExtra distance to take neighbors from.
Todo:
Change to the local corner information.

Definition at line 631 of file particletopologydescription.C.

References oofem::FloatArray::beDifferenceOf(), oofem::FloatMatrix::beLocalCoordSys(), oofem::FloatArray::beProductOf(), oofem::compare_second(), corners, oofem::FloatArray::distance_square(), oofem::FloatArray::dotProduct(), oofem::ParticlePoint::foot, getBoundingBox(), grid, oofem::ParticlePoint::id, m, oofem::ParticlePoint::normal, and tubeWidth.

Referenced by resample().

void oofem::ParticleTopologyDescription::doOutput ( TimeStep tStep)
virtual

File output of the current state of the topology description.

This is not handled by the export modules, since each type of representation can differ.

Parameters
tStepActive time step.

Reimplemented from oofem::TopologyDescription.

Definition at line 763 of file particletopologydescription.C.

References oofem::TopologyDescription::d, oofem::Domain::giveEngngModel(), oofem::TimeStep::giveNumber(), oofem::EngngModel::giveOutputBaseFileName(), writeVTK, and writeVTKFile().

bool oofem::ParticleTopologyDescription::findDisplacement ( FloatArray answer,
int  id,
const FloatArray footpoint,
TimeStep tStep 
) const
protected

Finds the displacement for the underlying FE-mesh.

Parameters
answerThe requested displacement.
idOnly elements of specified region is taken into account (unless id == 0).
footpointThe spatial coordinate where to find the displacement.
tStepThe time step for which to find the displacement.

Definition at line 718 of file particletopologydescription.C.

References oofem::FloatArray::add(), oofem::FloatArray::at(), oofem::FloatArray::beDifferenceOf(), oofem::Element::computeField(), oofem::FloatArray::computeSquaredNorm(), oofem::TopologyDescription::d, oofem::SpatialLocalizer::giveElementClosestToPoint(), oofem::Element::giveElementDofIDMask(), oofem::Domain::giveNumberOfSpatialDimensions(), oofem::IntArray::giveSize(), oofem::FloatArray::giveSize(), oofem::Domain::giveSpatialLocalizer(), oofem::TimeStep::giveTimeIncrement(), grid, OOFEM_WARNING, oofem::FloatArray::resize(), useDisplacements, and oofem::FloatArray::zero().

Referenced by updateYourself().

void oofem::ParticleTopologyDescription::generateMesh ( std::vector< FloatArray > &  nodes,
std::vector< IntArray > &  elements,
std::vector< IntArray > &  segments,
std::vector< IntArray > &  n_markers,
IntArray e_markers,
IntArray s_markers,
IntArray e_egt,
IntArray s_egt 
)
virtual

Generates a mesh from the topology.

Parameters
nodesNodes created.
elementsBulk elements created.
segmentsEdge/surface elements describing the topology.
n_markersNode markers.
e_markersElement markers.
s_markersSegment markers.
e_egtElement geometry types.
s_egtSegment geometry types.

Definition at line 1138 of file particletopologydescription.C.

References oofem::IntArray::at(), oofem::FloatArray::at(), corners, generatePSLG(), oofem::IntArray::giveSize(), grid, oofem::TriangleMesherInterface::meshPSLG(), regionInside, and regionOutside.

Referenced by replaceFEMesh().

void oofem::ParticleTopologyDescription::getBoundingBox ( FloatArray x0,
FloatArray x1,
const FloatArray c,
double  width 
)
staticprotected

Helper for common task of fetching a bounding box around a point.

Definition at line 617 of file particletopologydescription.C.

References oofem::FloatArray::add().

Referenced by addCircleSegment(), addCorner(), calculateShortestDistance(), checkOverlap(), collectNeighbors(), and generatePSLG().

virtual const char* oofem::ParticleTopologyDescription::giveClassName ( ) const
inlinevirtual

Gives the name of the class.

Implements oofem::TopologyDescription.

Definition at line 281 of file particletopologydescription.h.

void oofem::ParticleTopologyDescription::removePoints ( ParticleGrid< ParticlePoint > &  g) const
protected

Clears all points marked for removal.

Works recursively on refined grids.

Parameters
gGrid to clear.

Definition at line 407 of file particletopologydescription.C.

References oofem::ParticleGrid< Point >::clearPosition(), oofem::ParticleGrid< Point >::getPoint(), oofem::ParticleGrid< Point >::getTotal(), grid, oofem::ParticleGrid< Point >::isEmpty(), and oofem::ParticlePoint::removal.

Referenced by checkOverlap().

void oofem::ParticleTopologyDescription::resample ( )
protected

Resamples the grid.

Entire grid is replaced. Finds new foot points for new grid points along the curve.

Definition at line 591 of file particletopologydescription.C.

References calculateShortestDistance(), collectNeighbors(), grid, maxdisp2, and resampled.

Referenced by generatePSLG(), and updateYourself().

double oofem::ParticleTopologyDescription::shortestDistanceFromCurve ( const FloatArray a,
double  txi_min,
double  txi_max,
const FloatArray n0,
const FloatArray y0,
const FloatArray p,
FloatArray foot,
FloatArray normal 
) const
protected
void oofem::ParticleTopologyDescription::writeDataToFile ( const char *  name) const
virtual
void oofem::ParticleTopologyDescription::writeVTKFile ( const char *  name) const
virtual

Member Data Documentation

FloatMatrix oofem::ParticleTopologyDescription::controlID
protected

Definition at line 157 of file particletopologydescription.h.

Referenced by checkOverlap(), and instanciateYourself().

std :: list< ParticlePoint > oofem::ParticleTopologyDescription::corners
protected
std :: unique_ptr< ParticleGrid< ParticlePoint > > oofem::ParticleTopologyDescription::grid
protected
int oofem::ParticleTopologyDescription::m
protected

Number of points to use for resampling.

Definition at line 143 of file particletopologydescription.h.

Referenced by collectNeighbors(), and instanciateYourself().

double oofem::ParticleTopologyDescription::maxdisp2
protected

Maximum squared displacement of any particle.

Definition at line 139 of file particletopologydescription.h.

Referenced by resample(), and updateYourself().

FloatMatrix oofem::ParticleTopologyDescription::mergeID
protected

Definition at line 157 of file particletopologydescription.h.

Referenced by checkOverlap(), and instanciateYourself().

std :: vector< std :: string > oofem::ParticleTopologyDescription::regionElementType
protected

Mapping from region to FE components.

Definition at line 162 of file particletopologydescription.h.

Referenced by instanciateYourself(), and replaceFEMesh().

IntArray oofem::ParticleTopologyDescription::regionInside
protected

Definition at line 156 of file particletopologydescription.h.

Referenced by generateMesh(), and instanciateYourself().

IntArray oofem::ParticleTopologyDescription::regionOutside
protected

Mapping of regions from delimited by each id.

This is only needed for remeshing. Regions should be strictly different from any id in the domain, as the id's themselves map directly to regions. First value is the region on the normals direction, the second value is the other side.

Definition at line 156 of file particletopologydescription.h.

Referenced by generateMesh(), and instanciateYourself().

IntArray oofem::ParticleTopologyDescription::regionSet
protected

Definition at line 163 of file particletopologydescription.h.

Referenced by instanciateYourself(), and replaceFEMesh().

bool oofem::ParticleTopologyDescription::resampled
protected

Denotes if the active grid is newly resampled.

Definition at line 137 of file particletopologydescription.h.

Referenced by resample(), and updateYourself().

double oofem::ParticleTopologyDescription::tubeWidth
protected
bool oofem::ParticleTopologyDescription::useDisplacements
protected

Determines if velocity or displacements dofs should be used to update geometry.

Definition at line 133 of file particletopologydescription.h.

Referenced by findDisplacement().

bool oofem::ParticleTopologyDescription::writeVTK
protected

Conditional for printing VTK output.

Definition at line 135 of file particletopologydescription.h.

Referenced by doOutput(), and instanciateYourself().


The documentation for this class was generated from the following files:

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:39 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011