62 #include <vtkPoints.h> 63 #include <vtkPointData.h> 64 #include <vtkDoubleArray.h> 65 #include <vtkVertex.h> 66 #include <vtkCellArray.h> 67 #include <vtkCellData.h> 68 #include <vtkXMLPolyDataWriter.h> 69 #include <vtkPolyData.h> 70 #include <vtkSmartPointer.h> 101 double radius, alpha0, alpha1;
130 this->
tubeWidth = ( bb1(0) - bb0(0) ) / res * tubewidth;
134 for (
int i = 1; i <= nsegments; i++ ) {
138 if ( name.compare(
"line") == 0 ) {
142 }
else if ( name.compare(
"circle") == 0 ) {
149 alpha0 *=
M_PI / 180;
150 alpha1 *=
M_PI / 180;
152 }
else if ( name.compare(
"cornerpoint") == 0 ) {
156 OOFEM_ERROR(
"Unknown geometry type '%s'", name.c_str() );
175 double distance2, xi;
177 FloatArray v, new_normal(2), grid_p, new_foot, grid_p_v1;
180 v.
times(1 / line_length);
181 new_normal(0) = -v(1);
182 new_normal(1) = v(0);
187 x0.
add(-this->tubeWidth);
189 x1.
add(this->tubeWidth);
192 it.getGridPoint(grid_p);
196 if ( xi < 0 || xi > 1 ) {
202 new_foot.
add(xi * line_length, v);
206 if ( distance2 < tubeWidth2 ) {
207 if ( ( point = it.getPoint() ) ) {
212 point =
new ParticlePoint(new_foot,
id, new_normal, distance2);
222 FloatArray new_foot(2), new_normal(2), grid_p;
230 it.getGridPoint(grid_p);
232 double v = atan2( grid_p(1) - c(1), grid_p(0) - c(0) );
233 if ( v < v0 || v > v1 ) {
237 new_normal(0) = cos(v);
238 new_normal(1) = sin(v);
239 new_foot(0) = c(0) + cos(v) * r;
240 new_foot(1) = c(1) + sin(v) * r;
244 if ( distance2 < tubeWidth2 ) {
245 if ( ( point = it.getPoint() ) ) {
250 point =
new ParticlePoint(new_foot,
id, new_normal, distance2);
262 this->
corners.push_front(corner);
270 if ( ( point = it.getPoint() ) ) {
271 if ( point->
id ==
id ) {
296 if ( ( p = it.getPoint() ) != NULL ) {
312 grid->clearPosition( it.getIndex() );
319 for ( std :: list< ParticlePoint > :: iterator it = this->
corners.begin(); it != this->
corners.end(); ++it ) {
322 OOFEM_ERROR(
"This always needs to find a displacement");
324 it->foot.add(displacement);
325 it->total_displacement.add(displacement);
331 OOFEM_LOG_INFO(
"ParticleTopologyDescription :: updateYourself - Resampling\n");
336 OOFEM_LOG_INFO(
"ParticleTopologyDescription: user time consumed by updating: %.2fs\n", timer.
getUtime() );
346 std :: list< ParticlePoint * >points;
349 double normal_limit = 0.5, distance_limit = 0.0;
353 if ( ( p0 = it.getPoint() ) != NULL && p0->
id > 0 ) {
356 this->
grid->getPointsWithin(points, x0, x1);
358 std :: list< ParticlePoint * > :: iterator it_points;
359 for ( it_points = points.begin(); it_points != points.end(); it_points++ ) {
361 if ( p1->
id == p0->
id ) {
378 if ( distance < distance_limit ) {
383 OOFEM_ERROR(
"Conditions for merging surface not implemented yet.");
387 if ( p0->
id == control ) {
413 for (
int ind = 0; ind < g.
getTotal(); ind++ ) {
418 }
else if ( this->
grid->getSubGrid(sg, ind) ) {
434 int n = neighbors.size();
444 for ( std :: list< ParticlePoint * > :: iterator it = neighbors.begin(); it != neighbors.end(); ++it ) {
445 normal.
add( ( * it )->normal );
451 double txi_min = 0, txi_max = 0;
456 for ( std :: list< ParticlePoint * > :: iterator it = neighbors.begin(); it != neighbors.end(); ++it, ++i ) {
462 if ( tx(i) < txi_min ) {
464 }
else if ( tx(i) > txi_max ) {
472 double radius = this->
tubeWidth +
max(txi_max, -txi_min);
474 g.getBoundingBox(x0, x1, ind0, ind1);
484 for ( pos(0) = ind0(0); pos(0) < ind1(0); pos(0)++ ) {
485 for ( pos(1) = ind0(1); pos(1) < ind1(1); pos(1)++ ) {
486 g.getGridCoord(grid_point, pos);
493 grid_point, new_foot, new_normal);
495 if ( distance2 < tubeWidth2 ) {
496 if ( g.getPoint(point, pos) ) {
500 }
else if ( g.getSubGrid(subgrid, pos) ) {
503 point =
new ParticlePoint(new_foot, p0->id, new_normal, distance2);
504 g.setPoint(point, pos);
513 double b3, b2, b1, b0;
521 p_y0(0) = y0(0) - p(0);
522 p_y0(1) = y0(1) - p(1);
524 p_y0.beDifferenceOf(y0, p);
525 temp1 = n0(0) * p_y0(0) + n0(1) * p_y0(1);
526 temp2 = t0(0) * p_y0(0) + t0(1) * p_y0(1);
529 b3 = 2 * a(2) * a(2);
530 b2 = 3 * a(1) * a(2);
532 b1 = a(1) * a(1) + 2 * a(0) * a(2) + 1 + 2 * a(2) * temp1;
533 b0 = a(0) * a(1) + a(1) * temp1 + temp2;
540 cubic(b3, b2, b1, b0, & r [ 0 ], & r [ 1 ], & r [ 2 ], & roots);
543 double txi_list [ 5 ] = {
544 txi_min *limit, txi_max * limit
547 for (
int i = 0; i < roots; i++ ) {
548 if ( txi_min * limit < r [ i ] && r [ i ] < txi_max * limit ) {
549 txi_list [ points ] = r [ i ];
555 double min_distance2 = 0.0, min_txi = 0.0;
556 double dx, dy, distance2, f, fp, txi;
557 for (
int i = 0; i < points; i++ ) {
558 txi = txi_list [ i ];
559 f = a(0) + a(1) * txi + a(2) * txi * txi;
561 dx = n0(0) * f + t0(0) * txi + p_y0(0);
562 dy = n0(1) * f + t0(1) * txi + p_y0(1);
564 distance2 = dx * dx + dy * dy;
566 if ( i == 0 || distance2 < min_distance2 ) {
567 min_distance2 = distance2;
572 if ( min_txi < txi_min || min_txi > txi_max ) {
576 f = a(0) + a(1) * min_txi + a(2) * min_txi * min_txi;
577 fp = a(1) + 2 * a(2) * min_txi;
580 foot(0) = n0(0) * f + t0(0) * min_txi + y0(0);
581 foot(1) = n0(1) * f + t0(1) * min_txi + y0(1);
584 normal(0) = n0(0) + t0(0) * ( -fp );
585 normal(1) = n0(1) + t0(1) * ( -fp );
597 std :: list< ParticlePoint * >neighbours;
603 double maxdisp = sqrt(this->
maxdisp2);
604 int total_points = 0;
607 if ( ( origin = it.getPoint() ) != NULL ) {
613 this->
grid = std :: move( new_grid );
626 static bool compare_second(std :: pair< ParticlePoint *, double >a, std :: pair< ParticlePoint *, double >b)
628 return fabs(a.second) < fabs(b.second);
642 std :: list< ParticlePoint * >points;
647 this->
grid->getPointsWithin(points, x0, x1);
649 typedef std :: pair< ParticlePoint *, double >dist_pair;
650 std :: list< dist_pair >valid_points;
653 for ( std :: list< ParticlePoint > :: const_iterator it_corners =
corners.begin(); it_corners != this->
corners.end(); ++it_corners ) {
655 if ( p->
id != origin->
id ) {
664 valid_points.push_front( dist_pair( p, lcoord(0) ) );
668 std :: list< ParticlePoint * > :: iterator it_points;
669 for ( it_points = points.begin(); it_points != points.end(); ++it_points ) {
671 if ( p->
id != origin->
id ) {
676 if ( projection < 0.5 ) {
681 valid_points.push_front( dist_pair( p, lcoord(0) ) );
688 int m_smaller = 0, m_larger = 0;
689 double limit = 0.01 * this->
grid->getGridStep(0);
690 double smaller = -limit, larger = limit;
692 std :: list< dist_pair > :: iterator it = valid_points.begin();
693 for (
int i = 0; i < ( int ) valid_points.size(); i++, it++ ) {
694 if ( m_larger > 0 && m_smaller > 0 && m_larger + m_smaller >= this->
m ) {
697 if ( it->second > larger ) {
698 if ( m_larger >= this->
m ) {
701 larger = it->second + limit;
704 }
else if ( it->second < smaller ) {
705 if ( m_smaller >= this->
m ) {
708 smaller = it->second - limit;
714 answer.push_front(it->first);
726 OOFEM_WARNING(
"Couldn't find any element to interpolate from");
733 if ( dist > 0.25 * this->
grid->getGridStep(0) * this->
grid->getGridStep(0) ) {
734 OOFEM_WARNING(
"Foot point far from element (%e) (%e, %e)->(%e, %e).\n", sqrt(dist), footpoint.
at(1), footpoint.
at(2), closest.
at(1), closest.
at(2) );
740 e->
computeField(VM_Incremental, tStep, lcoords, displacement);
749 for (
int i = 0; i < dofIds.
giveSize(); i++ ) {
750 if ( dofIds(i) == V_u ) {
751 displacement(0) = fields(i) * dt;
752 }
else if ( dofIds(i) == V_v ) {
753 displacement(1) = fields(i) * dt;
754 }
else if ( dofIds(i) == V_w ) {
755 displacement(2) = fields(i) * dt;
759 displacement.
add(offset);
765 std :: ostringstream name;
776 FILE *fid = fopen(name,
"w");
783 if ( ( p = it.getPoint() ) != NULL ) {
784 it.getGridPoint(grid_coord);
788 for (
int i = 0; i < dims; i++ ) {
789 fprintf( fid,
"%e ", grid_coord(i) );
792 for (
int i = 0; i < dims; i++ ) {
793 fprintf( fid,
"%e ", p->
foot(i) );
796 for (
int i = 0; i < dims; i++ ) {
797 fprintf( fid,
"%e ", p->
normal(i) );
799 fprintf(fid,
"%d ", p->
id);
811 int dims = this->
grid->giveDimensions();
813 int npoints = this->
grid->getNumberOfPoints();
814 vtkSmartPointer< vtkPoints >points = vtkSmartPointer< vtkPoints > :: New();
815 vtkSmartPointer< vtkVertex >vertex;
816 vtkSmartPointer< vtkCellArray >vertices = vtkSmartPointer< vtkCellArray > :: New();
817 vtkSmartPointer< vtkDoubleArray >pointNormalsArray = vtkSmartPointer< vtkDoubleArray > :: New();
818 vtkSmartPointer< vtkIntArray >pointIDArray = vtkSmartPointer< vtkIntArray > :: New();
819 vtkSmartPointer< vtkDoubleArray >pointEndPointsArray = vtkSmartPointer< vtkDoubleArray > :: New();
821 pointIDArray->SetNumberOfComponents(1);
822 pointNormalsArray->SetNumberOfComponents(3);
823 pointEndPointsArray->SetNumberOfComponents(3);
825 pointIDArray->SetName(
"ID");
826 pointNormalsArray->SetName(
"Normals");
827 pointEndPointsArray->SetName(
"End points");
829 pointIDArray->SetNumberOfTuples(npoints);
830 pointNormalsArray->SetNumberOfTuples(npoints);
831 pointEndPointsArray->SetNumberOfTuples(npoints);
835 if ( ( p = it.getPoint() ) != NULL ) {
836 points->InsertNextPoint(p->
foot(0), p->
foot(1), dims == 3 ? p->
foot(2) : 0.0);
837 vertex = vtkSmartPointer< vtkVertex > :: New();
838 vertex->GetPointIds()->SetId(0, i);
839 vertices->InsertNextCell(vertex);
840 pointIDArray->SetTuple1(i, p->
id);
841 pointNormalsArray->SetTuple3(i, p->
normal(0), p->
normal(1), dims == 3 ? p->
normal(2) : 0.0);
845 pointEndPointsArray->InsertNextTuple3(0.0, 0.0, 0.0);
852 vtkSmartPointer< vtkPolyData >polydata = vtkSmartPointer< vtkPolyData > :: New();
853 polydata->SetPoints(points);
854 polydata->SetVerts(vertices);
855 polydata->GetPointData()->SetNormals(pointNormalsArray);
856 polydata->GetPointData()->SetVectors(pointEndPointsArray);
857 polydata->GetPointData()->SetScalars(pointIDArray);
860 vtkSmartPointer< vtkXMLPolyDataWriter >writer = vtkSmartPointer< vtkXMLPolyDataWriter > :: New();
861 writer->SetFileName(name);
862 writer->SetInput(polydata);
907 std :: list< node >nodes;
908 std :: list< ParticlePoint * >points;
912 double merge2 = this->
grid->getGridStep(1) * this->
grid->getGridStep(1) * 1e-2;
914 double limit = this->
grid->getGridStep(1) * 0.5;
919 if ( ( origin = it.getPoint() ) != NULL ) {
924 for ( std :: list< ParticlePoint > :: iterator cit = this->
corners.begin(); cit != this->
corners.end(); ++cit ) {
929 for ( std :: list< ParticlePoint > :: iterator cit = this->
corners.begin(); cit != this->
corners.end(); ++cit ) {
930 if ( cit->node != 0 ) {
934 cit->node = total_nodes;
939 for ( std :: list< ParticlePoint > :: iterator cit_ = this->
corners.begin(); cit_ != this->
corners.end(); ++cit_ ) {
940 if ( cit->foot.distance_square(cit_->foot) <= merge2 && cit_->node == 0 ) {
941 cit_->node = cit->node;
942 cit_->foot = cit->foot;
947 this->
grid->getPointsWithin(points, x0, x1);
948 for (
auto pit = points.begin(); pit != points.end(); pit++ ) {
949 if ( ( cit->foot.distance_square( ( * pit )->foot ) <= merge2 ) && ( * pit )->node == 0 ) {
950 ( * pit )->node = cit->node;
951 ( * pit )->foot = cit->foot;
957 if ( ( origin = it.getPoint() ) != NULL ) {
958 if ( origin->
node != 0 ) {
963 origin->
node = total_nodes;
970 this->
grid->getPointsWithin(points, x0, x1);
971 for (
auto pit = points.begin(); pit != points.end(); pit++ ) {
972 if ( ( * pit )->node == 0 ) {
981 ( * pit )->node = origin->
node;
982 ( * pit )->foot = origin->
foot;
990 std :: list< edge >edges;
992 double front_dist, back_dist, b_front_dist, b_back_dist;
994 if ( ( origin = it.getPoint() ) != NULL ) {
1004 front_dist = max_value;
1005 back_dist = -max_value;
1007 bool found_front =
false, found_back =
false;
1010 b_front_dist = -max_value;
1011 b_back_dist = max_value;
1014 this->
grid->getPointsWithin(points, x0, x1);
1017 for ( std :: list< ParticlePoint > :: iterator cit = this->
corners.begin(); cit != this->
corners.end(); ++cit ) {
1018 points.push_front(& * cit);
1021 for (
auto pit = points.begin(); pit != points.end(); ++pit ) {
1024 if ( p->
id != origin->
id || origin->
node == p->
node ) {
1037 if ( projection < 0.0 ) {
1039 if ( lcoord(0) > b_front_dist && !found_front ) {
1040 b_front_dist = lcoord(0);
1043 if ( lcoord(0) < b_back_dist && !found_back ) {
1044 b_back_dist = lcoord(0);
1051 if ( lcoord(0) > 0 ) {
1052 if ( lcoord(0) < front_dist ) {
1054 front_dist = lcoord(0);
1058 if ( lcoord(0) > back_dist ) {
1060 back_dist = lcoord(0);
1065 if ( e0.
first != 0 ) {
1066 edges.push_front(e0);
1069 edges.push_front(e1);
1079 std :: list< node > :: iterator it_node;
1081 for ( it_node = nodes.begin(); it_node != nodes.end(); it_node++ ) {
1082 fine.
nx(n) = it_node->c(0);
1083 fine.
ny(n) = it_node->c(1);
1090 std :: list< edge > :: iterator it_edge;
1092 for ( it_edge = edges.begin(); it_edge != edges.end(); it_edge++ ) {
1113 FILE *file = fopen(
"pslg.m",
"w");
1115 fprintf(file,
"edges = [");
1119 fprintf(file,
"];\n");
1121 fprintf(file,
"nodes = [");
1122 for (
int i = 0; i < pslg.
nx.
giveSize(); i++ ) {
1123 fprintf( file,
"%e, %e;\n", pslg.
nx(i), pslg.
ny(i) );
1125 fprintf(file,
"];\n");
1127 fprintf(file,
"colors = 'grbkmcygrbkmcygrbkmcy';\n");
1128 fprintf(file,
"hold on, axis equal\n");
1129 fprintf(file,
"for i = 1:size(nodes,1)\n plot(nodes(i,1),nodes(i,2),'rx'); %%text(nodes(i,1),nodes(i,2),num2str(i)); \nend\n");
1131 fprintf(file,
"for i = 1:size(edges,1)\n quiver(nodes(edges(i,1),1),nodes(edges(i,1),2),nodes(edges(i,2),1)-nodes(edges(i,1),1),nodes(edges(i,2),2)-nodes(edges(i,1),2),1,colors(edges(i,3)));\nend\n");
1132 fprintf(file,
"for i = 1:size(edges,1)\n %%text(mean(nodes(edges(i,1:2),1)),mean(nodes(edges(i,1:2),2)),['\\color{red} ',num2str(i)]);\nend\n");
1141 double maxArea = 0.05;
1151 nodes, n_markers, elements, e_markers, segments, s_markers);
1154 #if 0 // Replace by this... 1157 if ( ( origin = it.getPoint() ) != NULL ) {
1158 double dist2, min_dist2 = 1e100;
1160 for (
int i = 1; i <= ( int ) nodes.size(); ++i ) {
1161 dist2 = nodes [ i - 1 ].distance_square(point->foot);
1162 if ( dist2 < min_dist2 ) {
1167 n_markers.at(min_i)->insertSortedOnce(point->id);
1171 for ( std :: list< ParticlePoint > :: iterator cit = this->
corners.begin(); cit != this->
corners.end(); ++cit ) {
1172 double dist2, min_dist2 = 1e100;
1174 for (
int i = 1; i <= ( int ) nodes.size(); ++i ) {
1175 dist2 = nodes [ i - 1 ].distance_square(cit->foot);
1176 if ( dist2 < min_dist2 ) {
1181 n_markers [ min_i - 1 ].insertSortedOnce(cit->id);
1185 #if 1 // DEBUG: Print all to matlab file 1186 printf(
"Printing mesh.m\n");
1187 FILE *file = fopen(
"mesh.m",
"w");
1188 fprintf(file,
"nodes = [");
1189 for (
int i = 1; i <= ( int ) nodes.size(); i++ ) {
1191 for (
int j = 1; j <= 2; j++ ) {
1192 fprintf( file,
"%e, ", x.
at(j) );
1194 fprintf( file,
" %d", n_markers [ i - 1 ].at(1) );
1195 fprintf(file,
";\n");
1197 fprintf(file,
"];\n");
1199 fprintf(file,
"triangles = [");
1200 for (
int i = 1; i <= ( int ) elements.size(); i++ ) {
1202 for (
int j = 1; j <= x.
giveSize(); j++ ) {
1203 fprintf( file,
"%d, ", x.
at(j) );
1205 fprintf( file,
"%d", e_markers.
at(i) );
1206 fprintf(file,
";\n");
1208 fprintf(file,
"];\n");
1210 fprintf(file,
"segments = [");
1211 for (
int i = 1; i <= ( int ) segments.size(); i++ ) {
1213 for (
int j = 1; j <= x.
giveSize(); j++ ) {
1214 fprintf( file,
"%d, ", x.
at(j) );
1216 fprintf( file,
"%d", s_markers.
at(i) );
1217 fprintf(file,
";\n");
1219 fprintf(file,
"];\n");
1222 fprintf(file,
"clf\nhold on\n xx = nodes(:,1); yy = nodes(:,2); patch(xx(triangles(:,1:3))',yy(triangles(:,1:3))',triangles(:,end)'); \n");
1223 fprintf(file,
"for i = 1:size(segments,1); plot(nodes(segments(i,1:2),1), nodes(segments(i,1:2),2), 'b'); end\n");
1231 std :: vector< FloatArray >nodes;
1232 std :: vector< IntArray >elements, segments, n_markers;
1236 IntArray e_markers, s_markers, e_egt, s_egt;
1237 this->
generateMesh(nodes, elements, segments, n_markers, e_markers, s_markers, e_egt, s_egt);
1239 for (
int i = 1; i <= ( int ) elements.size(); ++i ) {
1240 int r = e_markers.at(i);
1243 boundarySets [
set - 1 ].followedBy(i);
1244 boundarySets [
set - 1 ].followedBy(0);
1247 for (
int i = 1; i <= ( int ) segments.size(); ++i ) {
1248 int r = s_markers.at(i);
1251 boundarySets [
set - 1 ].followedBy( i + elements.size() );
1252 boundarySets [
set - 1 ].followedBy(0);
1266 for (
int i = 1; i <= ( int ) nodes.size(); ++i ) {
1275 for (
int i = 1; i <= ( int ) elements.size(); ++i ) {
1276 int r = e_markers.at(i);
1289 for (
int i = 1; i <= ( int ) segments.size(); ++i ) {
1290 int r = s_markers.at(i);
1306 for (
int i = 1; i <= ( int ) boundarySets.size(); ++i ) {
1310 Set *
set =
new Set(1, new_d);
1311 set->setBoundaryList(boundarySets [ i - 1 ]);
void removePoints(ParticleGrid< ParticlePoint > &g) const
Clears all points marked for removal.
void addLineSegment(int id, const FloatArray &p0, const FloatArray &p1, ParticleGrid< ParticlePoint > &grid) const
Used for initialization, calculating the distance from primitives.
std::string giveOutputBaseFileName()
Returns base output file name to which extensions, like .out .vtu .osf should be added.
void resizeDofManagers(int _newSize)
Resizes the internal data structure to accommodate space for _newSize dofManagers.
#define _IFT_ParticleTopologyDescription_numberOfSegments
bool writeVTK
Conditional for printing VTK output.
static void getBoundingBox(FloatArray &x0, FloatArray &x1, const FloatArray &c, double width)
Helper for common task of fetching a bounding box around a point.
IntArray segment_b
Second segment connection.
IntArray regionOutside
Mapping of regions from delimited by each id.
void resizeSets(int _newSize)
Resizes the internal data structure to accommodate space for _newSize sets.
#define _IFT_Meshing_elementType
#define _IFT_Circle_center
static bool compare_edge(edge a, edge b)
ParticleTopologyDescription(Domain *d)
virtual void writeVTKFile(const char *name) const
FloatArray corner
Corner particle (for open surfaces).
A recursive iterator for a grid with refinements.
void zero()
Sets all component to zero.
double & at(int i)
Coefficient access function.
int max(int i, int j)
Returns bigger value form two given decimals.
void postInitialize()
Performs post-initialization for all the domain contents (which is called after initializeFrom).
static void simplifyPSLG(Triangle_PSLG &coarse, const Triangle_PSLG &pslg, double limit, double minlen=0.0)
Simplifies a PSLG while respecting topology, running in linear time.
REGISTER_TopologyDescription(ParticleTopologyDescription)
int getTotal() const
Total number potential points.
bool meshPSLG(const Triangle_PSLG &pslg, const IntArray &outside, const IntArray &inside, std::vector< FloatArray > &nodes, std::vector< IntArray > &n_markers, std::vector< IntArray > &triangles, IntArray &t_markers, std::vector< IntArray > &segments, IntArray &s_markers) const
Constructs a mesh from a PSLG.
#define _IFT_Point_coords
Indicates that everything is OK with respect to topology.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
virtual TopologyState updateYourself(TimeStep *tStep)
Updates the topology from the FE solution.
#define _IFT_ParticleTopologyDescription_boundingBoxA
Abstract base class for all finite elements.
void resizeElements(int _newSize)
Resizes the internal data structure to accommodate space for _newSize elements.
Class representing the abstraction for input data source.
Indicates that the topology has reached a need for remeshing, as the case with merging surfaces...
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Particle grid data structure for n-D grids.
#define _IFT_ParticleTopologyDescription_boundingBoxB
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
void beMaxOf(const FloatArray &a, const FloatArray &b)
Sets receiver to maximum of a or b's respective elements.
virtual bool instanciateYourself(DataReader &dr)
Instanciates itself.
void setParallelMode(elementParallelMode _mode)
Sets parallel mode of element.
virtual void doOutput(TimeStep *tStep)
File output of the current state of the topology description.
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be a - b.
#define _IFT_ParticleTopologyDescription_nsd
double giveTimeIncrement()
Returns solution step associated time increment.
#define _IFT_Circle_start
FloatArray ny
Nodes y coordinates.
FloatArray total_displacement
Total displacement since last resampling.
void cubic(double a, double b, double c, double d, double *r1, double *r2, double *r3, int *num)
Solves cubic equation for real roots.
FloatArray foot
Closest coordinate on surface.
#define _IFT_ParticleTopologyDescription_neighbors
virtual void writeDataToFile(const char *name) const
void beMinOf(const FloatArray &a, const FloatArray &b)
Sets receiver to be minimum of a or b's respective elements.
#define _IFT_ParticleTopologyDescription_baseResolution
int giveNumber()
Returns receiver's number.
#define OOFEM_LOG_INFO(...)
#define _IFT_ParticleTopologyDescription_regionInside
#define _IFT_ParticleTopologyDescription_regionOutside
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
static bool compare_second(std::pair< ParticlePoint *, double >a, std::pair< ParticlePoint *, double >b)
bool resampled
Denotes if the active grid is newly resampled.
void resample()
Resamples the grid.
double computeSquaredNorm() const
Computes the square of the norm.
std::unique_ptr< ParticleGrid< ParticlePoint > > grid
The grid of points, the actual topological information.
Set of elements, boundaries, edges and/or nodes.
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver's associated spatial localizer.
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.
int maximum() const
Finds the maximum component in the array.
void beLocalCoordSys(const FloatArray &normal)
Makes receiver the local coordinate for the given normal.
Domain * d
Domain which topology belongs to.
virtual void setCrossSection(int csIndx)
Sets the cross section model of receiver.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
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.
virtual void replaceFEMesh()
Generates the FE components from the bare mesh.
Default point type for describing topology.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
Plane straight line graph used as input for meshing with triangle.
double at(int i, int j) const
Coefficient access function.
double distance_square(const FloatArray &iP1, const FloatArray &iP2, double &oXi, double &oXiUnbounded) const
void resize(int n)
Checks size of receiver towards requested bounds.
#define _IFT_ParticleTopologyDescription_identification
void ls2fit(const FloatArray &x, const FloatArray &y, FloatArray &a)
Least-square fit of 2nd degree polynomial .
void addCorner(int id, const FloatArray &c, ParticleGrid< ParticlePoint > &grid)
Adds a corner node.
void collectNeighbors(std::list< ParticlePoint * > &answer, const ParticlePoint *p, double dist=0) const
Collects neighboring points according to some specification.
void setDofManagers(const IntArray &dmans)
Sets receiver dofManagers.
virtual InputRecord * giveInputRecord(InputRecordType irType, int recordId)=0
Returns input record corresponding to given InputRecordType value and its record_id.
void add(int val)
Adds given scalar to all values of receiver.
Class representing vector of real numbers.
virtual int checkConsistency()
Allows programmer to test some receiver's internal data, before computation begins.
virtual int init(bool force=false)
Initialize receiver data structure if not done previously If force is set to true, the initialization is enforced (useful if domain geometry has changed)
Element is local, there are no contributions from other domains to this element.
Implementation of matrix containing floating point numbers.
#define _IFT_Circle_radius
IRResultType
Type defining the return values of InputRecord reading operations.
int m
Number of points to use for resampling.
void setCoordinates(FloatArray coords)
Sets node coordinates to given array.
void setDofManager(int i, DofManager *obj)
Sets i-th component. The component will be further managed and maintained by domain object...
double computeNorm() const
Computes the norm (or length) of the vector.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
virtual Element * giveElementClosestToPoint(FloatArray &lcoords, FloatArray &closest, const FloatArray &coords, int region=0)=0
Returns the element closest to a given point.
void zero()
Zeroes all coefficients of receiver.
virtual ~ParticleTopologyDescription()
Class implementing single timer, providing wall clock and user time capabilities. ...
int node
Node number (for meshing)
void setGlobalNumber(int num)
Sets receiver globally unique number.
void setElement(int i, Element *obj)
Sets i-th component. The component will be further managed and maintained by domain object...
Abstract class for topology description.
void times(double s)
Multiplies receiver with scalar.
ClassFactory & classFactory
Interface to Triangle (Delaunay mesher).
double tubeWidth
Width of the tube around the interfaces.
void push_back(const double &iVal)
Add one element.
void calculateShortestDistance(const ParticlePoint *p, std::list< ParticlePoint * > &points, ParticleGrid< ParticlePoint > &grid) const
Shortest distance from least square fit based on 2nd order polynomial.
std::list< ParticlePoint > corners
Corner nodes.
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.
double maxdisp2
Maximum squared displacement of any particle.
FloatArray normal
Surface normal at foot point.
virtual int forceEquationNumbering(int i)
Forces equation renumbering on given domain.
TopologyState checkOverlap()
Deactivates points with inconsistent information.
int giveSize() const
Returns the size of receiver.
#define _IFT_ParticleTopologyDescription_tubeWidth
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Computes the unknown vector interpolated at the specified local coordinates.
FloatArray nx
Nodes x coordinates.
the oofem namespace is to define a context or scope in which all oofem names are defined.
static bool sort_edge(edge a, edge b)
Class implementing node in finite element mesh.
void generatePSLG(Triangle_PSLG &PSLG)
Generates the PSLG for meshing with Triangle.
double normalize()
Normalizes receiver.
Element * createElement(const char *name, int num, Domain *domain)
Creates new instance of element corresponding to given keyword.
bool useDisplacements
Determines if velocity or displacements dofs should be used to update geometry.
std::vector< std::string > regionElementType
Mapping from region to FE components.
bool isEmpty() const
Returns true if the entire grid is empty.
double getUtime()
Returns total user time elapsed in seconds.
TopologyState
Determines the state of the evolving topology.
bool findDisplacement(FloatArray &answer, int id, const FloatArray &footpoint, TimeStep *tStep) const
Finds the displacement for the underlying FE-mesh.
void setSet(int i, Set *obj)
Sets i-th component. The component will be further managed and maintained by domain object...
#define OOFEM_WARNING(...)
Class representing solution step.
double distance2
Squared distance stored for efficiency.
void add(const FloatArray &src)
Adds array src to receiver.
IntArray segment_a
First segment connection.
bool getPoint(Point *&answer, const IntArray &pos) const
Gives the point at the position.
IntArray segment_marker
Segment markers.
iterator beginAt(const FloatArray &x0, const FloatArray &x1)
Returns an iterator over specified region.
void clearPosition(const IntArray &pos)
Deletes any preexisting data at position.
void resize(int s)
Resizes receiver towards requested size.