OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
A grid based particle method for describing topology. More...
#include <particletopologydescription.h>
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< ParticlePoint > | corners |
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 | |
Domain * | d |
Domain which topology belongs to. More... | |
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.
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.
Definition at line 129 of file particletopologydescription.h.
oofem::ParticleTopologyDescription::ParticleTopologyDescription | ( | Domain * | d | ) |
Definition at line 77 of file particletopologydescription.C.
|
virtual |
Definition at line 80 of file particletopologydescription.C.
References corners.
|
protected |
Used for initialization, calculating the distance from primitives.
Adds a circle segment from p0 to p1, with center at c.
id | ID for segment. |
c | Center coordinate. |
r | Radius. |
v0 | Lower angle [-pi,pi]. |
v1 | Upper angle [-pi,pi]. |
grid | Grid 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().
|
protected |
Adds a corner node.
id | ID for corner. |
c | Coordinate of corner. |
grid | Grid to add corner to. |
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().
|
protected |
Used for initialization, calculating the distance from primitives.
Adds line segment from p0 to p1.
id | ID for segment. |
p0 | First corner of the edge. |
p1 | Second corner of the edge. |
grid | Grid 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().
|
protected |
Shortest distance from least square fit based on 2nd order polynomial.
Definition at line 428 of file particletopologydescription.C.
References oofem::FloatArray::add(), oofem::FloatArray::beDifferenceOf(), oofem::FloatMatrix::beLocalCoordSys(), oofem::FloatArray::beProductOf(), oofem::ParticlePoint::distance2, oofem::FloatArray::distance_square(), getBoundingBox(), oofem::ls2fit(), oofem::max(), N, oofem::FloatArray::normalize(), OOFEM_ERROR, shortestDistanceFromCurve(), and tubeWidth.
Referenced by resample().
|
protected |
Deactivates points with inconsistent information.
This is typically due to merging surfaces or vanishing pores.
Definition at line 342 of file particletopologydescription.C.
References oofem::FloatMatrix::at(), oofem::FloatArray::beDifferenceOf(), oofem::FloatArray::computeNorm(), controlID, oofem::ParticlePoint::corner, oofem::FloatArray::distance_square(), oofem::FloatArray::dotProduct(), oofem::ParticlePoint::foot, getBoundingBox(), oofem::FloatArray::giveSize(), grid, oofem::ParticlePoint::id, mergeID, oofem::ParticlePoint::normal, OOFEM_ERROR, oofem::ParticlePoint::removal, removePoints(), oofem::ParticlePoint::total_displacement, oofem::TS_NeedsRemeshing, oofem::TS_OK, and tubeWidth.
Referenced by instanciateYourself(), and updateYourself().
|
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.
answer | The neighboring particles. |
p | Point to compute neighbors around. |
dist | Extra distance to take neighbors from. |
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().
|
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.
tStep | Active 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().
|
protected |
Finds the displacement for the underlying FE-mesh.
answer | The requested displacement. |
id | Only elements of specified region is taken into account (unless id == 0). |
footpoint | The spatial coordinate where to find the displacement. |
tStep | The 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().
|
virtual |
Generates a mesh from the topology.
nodes | Nodes created. |
elements | Bulk elements created. |
segments | Edge/surface elements describing the topology. |
n_markers | Node markers. |
e_markers | Element markers. |
s_markers | Segment markers. |
e_egt | Element geometry types. |
s_egt | Segment 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().
|
protected |
Generates the PSLG for meshing with Triangle.
PSLG | Generated structure ready for meshing. |
Definition at line 898 of file particletopologydescription.C.
References oofem::FloatArray::beDifferenceOf(), oofem::FloatMatrix::beLocalCoordSys(), oofem::FloatArray::beProductOf(), oofem::node::c, oofem::compare_edge(), oofem::FloatArray::computeSquaredNorm(), corners, oofem::FloatArray::distance_square(), oofem::FloatArray::dotProduct(), oofem::edge::first, oofem::ParticlePoint::foot, getBoundingBox(), oofem::IntArray::giveSize(), oofem::FloatArray::giveSize(), grid, oofem::ParticlePoint::id, oofem::edge::id, oofem::node::id, oofem::ParticlePoint::node, oofem::ParticlePoint::normal, oofem::Triangle_PSLG::nx, oofem::Triangle_PSLG::ny, oofem::FloatArray::push_back(), resample(), oofem::IntArray::resize(), oofem::FloatArray::resize(), oofem::edge::second, oofem::Triangle_PSLG::segment_a, oofem::Triangle_PSLG::segment_b, oofem::Triangle_PSLG::segment_marker, oofem::TriangleMesherInterface::simplifyPSLG(), oofem::sort_edge(), tubeWidth, and writeVTKFile().
Referenced by generateMesh().
|
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().
|
inlinevirtual |
Gives the name of the class.
Implements oofem::TopologyDescription.
Definition at line 281 of file particletopologydescription.h.
|
virtual |
Instanciates itself.
Implements oofem::TopologyDescription.
Definition at line 87 of file particletopologydescription.C.
References _IFT_Circle_center, _IFT_Circle_end, _IFT_Circle_radius, _IFT_Circle_start, _IFT_Line_end, _IFT_Line_start, _IFT_Meshing_elementType, _IFT_Meshing_set, _IFT_ParticleTopologyDescription_baseResolution, _IFT_ParticleTopologyDescription_boundingBoxA, _IFT_ParticleTopologyDescription_boundingBoxB, _IFT_ParticleTopologyDescription_identification, _IFT_ParticleTopologyDescription_neighbors, _IFT_ParticleTopologyDescription_nsd, _IFT_ParticleTopologyDescription_numberOfSegments, _IFT_ParticleTopologyDescription_regionInside, _IFT_ParticleTopologyDescription_regionOutside, _IFT_ParticleTopologyDescription_tubeWidth, _IFT_Point_coords, oofem::IntArray::add(), addCircleSegment(), addCorner(), addLineSegment(), checkOverlap(), controlID, oofem::InputRecord::finish(), oofem::DataReader::giveInputRecord(), oofem::IntArray::giveSize(), grid, oofem::DataReader::IR_gbpmRec, oofem::DataReader::IR_geometryRec, IR_GIVE_FIELD, IR_GIVE_OPTIONAL_FIELD, IR_GIVE_RECORD_KEYWORD_FIELD, m, M_PI, mergeID, OOFEM_ERROR, regionElementType, regionInside, regionOutside, regionSet, oofem::IntArray::resize(), oofem::FloatMatrix::resize(), tubeWidth, writeVTK, and oofem::IntArray::zero().
|
protected |
Clears all points marked for removal.
Works recursively on refined grids.
g | Grid 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().
|
virtual |
Generates the FE components from the bare mesh.
Does not map fields or internal variables.
Reimplemented from oofem::TopologyDescription.
Definition at line 1229 of file particletopologydescription.C.
References oofem::IntArray::at(), oofem::EngngModel::checkConsistency(), oofem::classFactory, oofem::ClassFactory::createElement(), oofem::TopologyDescription::d, oofem::Element_local, oofem::EngngModel::forceEquationNumbering(), generateMesh(), oofem::Domain::giveEngngModel(), oofem::FEMComponent::giveNumber(), oofem::IntArray::giveSize(), oofem::IntArray::maximum(), oofem::Domain::postInitialize(), regionElementType, regionSet, oofem::Domain::resizeDofManagers(), oofem::Domain::resizeElements(), oofem::Domain::resizeSets(), oofem::Node::setCoordinates(), oofem::Element::setCrossSection(), oofem::Domain::setDofManager(), oofem::Element::setDofManagers(), oofem::Domain::setElement(), oofem::Element::setGlobalNumber(), oofem::Element::setParallelMode(), and oofem::Domain::setSet().
|
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().
|
protected |
Helper for calculateShortestDistance.
Definition at line 510 of file particletopologydescription.C.
References oofem::cubic(), oofem::FloatArray::distance_square(), oofem::FloatArray::normalize(), oofem::FloatArray::resize(), and tubeWidth.
Referenced by calculateShortestDistance().
|
virtual |
Updates the topology from the FE solution.
tStep | Active time step. |
Implements oofem::TopologyDescription.
Definition at line 280 of file particletopologydescription.C.
References oofem::FloatArray::add(), checkOverlap(), oofem::FloatArray::computeSquaredNorm(), oofem::ParticlePoint::corner, corners, oofem::TopologyDescription::d, findDisplacement(), oofem::ParticlePoint::foot, oofem::Timer::getUtime(), oofem::FloatArray::giveSize(), oofem::Domain::giveSpatialLocalizer(), grid, oofem::ParticlePoint::id, oofem::SpatialLocalizer::init(), oofem::max(), maxdisp2, OOFEM_ERROR, OOFEM_LOG_INFO, resample(), resampled, oofem::Timer::startTimer(), oofem::Timer::stopTimer(), oofem::ParticlePoint::total_displacement, oofem::TS_OK, and tubeWidth.
|
virtual |
Definition at line 773 of file particletopologydescription.C.
References oofem::ParticlePoint::foot, oofem::FloatArray::giveSize(), grid, oofem::ParticlePoint::id, and oofem::ParticlePoint::normal.
|
virtual |
Definition at line 807 of file particletopologydescription.C.
References oofem::ParticlePoint::corner, oofem::ParticlePoint::foot, oofem::FloatArray::giveSize(), grid, oofem::ParticlePoint::id, oofem::ParticlePoint::normal, and OOFEM_WARNING.
Referenced by doOutput(), and generatePSLG().
|
protected |
Definition at line 157 of file particletopologydescription.h.
Referenced by checkOverlap(), and instanciateYourself().
|
protected |
Corner nodes.
Definition at line 148 of file particletopologydescription.h.
Referenced by addCorner(), collectNeighbors(), generateMesh(), generatePSLG(), updateYourself(), and ~ParticleTopologyDescription().
|
protected |
The grid of points, the actual topological information.
Definition at line 145 of file particletopologydescription.h.
Referenced by addCircleSegment(), addLineSegment(), checkOverlap(), collectNeighbors(), findDisplacement(), generateMesh(), generatePSLG(), instanciateYourself(), removePoints(), resample(), updateYourself(), writeDataToFile(), and writeVTKFile().
|
protected |
Number of points to use for resampling.
Definition at line 143 of file particletopologydescription.h.
Referenced by collectNeighbors(), and instanciateYourself().
|
protected |
Maximum squared displacement of any particle.
Definition at line 139 of file particletopologydescription.h.
Referenced by resample(), and updateYourself().
|
protected |
Definition at line 157 of file particletopologydescription.h.
Referenced by checkOverlap(), and instanciateYourself().
|
protected |
Mapping from region to FE components.
Definition at line 162 of file particletopologydescription.h.
Referenced by instanciateYourself(), and replaceFEMesh().
|
protected |
Definition at line 156 of file particletopologydescription.h.
Referenced by generateMesh(), and instanciateYourself().
|
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().
|
protected |
Definition at line 163 of file particletopologydescription.h.
Referenced by instanciateYourself(), and replaceFEMesh().
|
protected |
Denotes if the active grid is newly resampled.
Definition at line 137 of file particletopologydescription.h.
Referenced by resample(), and updateYourself().
|
protected |
Width of the tube around the interfaces.
Definition at line 141 of file particletopologydescription.h.
Referenced by addCircleSegment(), addCorner(), addLineSegment(), calculateShortestDistance(), checkOverlap(), collectNeighbors(), generatePSLG(), instanciateYourself(), shortestDistanceFromCurve(), and updateYourself().
|
protected |
Determines if velocity or displacements dofs should be used to update geometry.
Definition at line 133 of file particletopologydescription.h.
Referenced by findDisplacement().
|
protected |
Conditional for printing VTK output.
Definition at line 135 of file particletopologydescription.h.
Referenced by doOutput(), and instanciateYourself().