44 #ifndef CORE_DATATYPES_STRUCTQUADSURFMESH_H
45 #define CORE_DATATYPES_STRUCTQUADSURFMESH_H 1
69 template <
class Basis>
83 #if (SCIRUN_STRUCTQUADSURF_SUPPORT > 0)
90 template <
class Basis>
91 class StructQuadSurfMesh :
public ImageMesh<Basis>
104 typedef boost::shared_ptr<StructQuadSurfMesh<Basis> >
handle_type;
120 virtual bool get_dim(std::vector<size_type>&)
const;
121 virtual void set_dim(std::vector<size_type> dims) {
125 points_.resize(dims[1], dims[0]);
149 return (p1 - p0).length();
158 const double a0 =
Cross(p0 - p1, p2 - p0).
length();
159 const double a1 =
Cross(p2 - p3, p0 - p2).
length();
160 return (a0 + a1) * 0.5;
164 {
ASSERTFAIL(
"This mesh type does not have cells use \"elem\"."); }
170 {
ASSERTFAIL(
"This mesh type does not have cells use \"elem\"."); }
180 std::vector<Core::Geometry::Point> Jv;
181 this->
basis_.derivate(coords, ed, Jv);
194 {
ASSERTFAIL(
"This mesh type does not have cells use \"elem\"."); }
207 {
ASSERTFAIL(
"This mesh type does not have cells use \"elem\"."); }
209 template <
class ARRAY>
237 {
ASSERTFAIL(
"StructQuadSurfMesh::get_weights for edges isn't supported"); }
242 {
ASSERTFAIL(
"This mesh type does not have cells use \"elem\"."); }
273 return (index_.
i_ + mesh_.get_ni()*index_.
j_);
278 return (index_.
i_+ 1 + mesh_.get_ni()*index_.
j_);
283 return (index_.
i_ + 1 + mesh_.get_ni()*(index_.
j_ + 1));
289 return (index_.
i_ + mesh_.get_ni()*(index_.
j_ + 1));
296 return index_.
i_ + index_.
j_ * (mesh_.ni_- 1);
301 return index_.
i_ + (index_.
j_ + 1) * (mesh_.ni_ - 1);
306 return index_.
i_ *(mesh_.nj_ - 1) + index_.
j_ +
307 ((mesh_.ni_ - 1) * mesh_.nj_);
312 return (index_.
i_ + 1) * (mesh_.nj_ - 1) + index_.
j_ +
313 ((mesh_.ni_ - 1) * mesh_.nj_);
320 return mesh_.points_(index_.
j_, index_.
i_);
325 return mesh_.points_(index_.
j_, index_.
i_+1);
330 return mesh_.points_(index_.
j_+1, index_.
i_+1);
335 return mesh_.points_(index_.
j_+1, index_.
i_);
340 return mesh_.points_(index_.
j_, index_.
i_);
355 unsigned div_per_unit)
const
359 int emap[] = {0, 2, 3, 1};
360 this->
basis_.approx_edge(emap[which_edge], div_per_unit, coords);
366 template<
class VECTOR>
371 return this->
basis_.get_coords(coords, p, ed);
376 template<
class VECTOR>
381 pt = this->
basis_.interpolate(coords, ed);
388 template<
class VECTOR1,
class VECTOR2>
394 this->
basis_.derivate(coords, ed, J);
400 template<
class VECTOR>
412 template<
class VECTOR>
419 this->
basis_.derivate(coords,ed,Jv);
437 template<
class VECTOR>
444 this->
basis_.derivate(coords,ed,Jv);
462 template<
class INDEX>
476 size_t num_vertices = this->
basis_.number_of_vertices();
477 for (
size_t j=0;j < num_vertices;j++)
479 this->
basis_.derivate(this->
basis_.unit_vertices[j],ed,Jv);
484 if(temp < min_jacobian) min_jacobian = temp;
487 return (min_jacobian);
491 template<
class INDEX>
505 size_t num_vertices = this->
basis_.number_of_vertices();
506 for (
size_t j=0;j < num_vertices;j++)
508 this->
basis_.derivate(this->
basis_.unit_vertices[j],ed,Jv);
513 if(temp < min_jacobian) min_jacobian = temp;
516 return (min_jacobian);
520 template <
class INDEX>
527 const double x0 = p0.
x();
528 const double y0 = p0.
y();
529 const double z0 = p0.
z();
530 const double x1 = p1.
x();
531 const double y1 = p1.
y();
532 const double z1 = p1.
z();
533 const double x2 = p2.
x();
534 const double y2 = p2.
y();
535 const double z2 = p2.
z();
536 const double x3 = p3.
x();
537 const double y3 = p3.
y();
538 const double z3 = p3.
z();
540 const double a0 = + x1*(y2*z3-y3*z2) + x2*(y3*z1-y1*z3) + x3*(y1*z2-y2*z1);
541 const double a1 = - x2*(y3*z0-y0*z3) - x3*(y0*z2-y2*z0) - x0*(y2*z3-y3*z2);
542 const double a2 = + x3*(y0*z1-y1*z0) + x0*(y1*z3-y3*z1) + x1*(y3*z0-y0*z3);
543 const double a3 = - x0*(y1*z2-y2*z1) - x1*(y2*z0-y0*z2) - x2*(y0*z1-y1*z0);
544 const double iV6 = 1.0 / (a0+a1+a2+a3);
546 const double b0 = - (y2*z3-y3*z2) - (y3*z1-y1*z3) - (y1*z2-y2*z1);
547 const double c0 = + (x2*z3-x3*z2) + (x3*z1-x1*z3) + (x1*z2-x2*z1);
548 const double d0 = - (x2*y3-x3*y2) - (x3*y1-x1*y3) - (x1*y2-x2*y1);
549 const double s0 = iV6 * (a0 + b0*p.
x() + c0*p.
y() + d0*p.
z());
550 if (s0 < -1e-8)
return (
false);
552 const double b1 = + (y3*z0-y0*z3) + (y0*z2-y2*z0) + (y2*z3-y3*z2);
553 const double c1 = - (x3*z0-x0*z3) - (x0*z2-x2*z0) - (x2*z3-x3*z2);
554 const double d1 = + (x3*y0-x0*y3) + (x0*y2-x2*y0) + (x2*y3-x3*y2);
555 const double s1 = iV6 * (a1 + b1*p.
x() + c1*p.
y() + d1*p.
z());
556 if (s1 < -1e-8)
return (
false);
558 const double b2 = - (y0*z1-y1*z0) - (y1*z3-y3*z1) - (y3*z0-y0*z3);
559 const double c2 = + (x0*z1-x1*z0) + (x1*z3-x3*z1) + (x3*z0-x0*z3);
560 const double d2 = - (x0*y1-x1*y0) - (x1*y3-x3*y1) - (x3*y0-x0*y3);
561 const double s2 = iV6 * (a2 + b2*p.
x() + c2*p.
y() + d2*p.
z());
562 if (s2 < -1e-8)
return (
false);
564 const double b3 = +(y1*z2-y2*z1) + (y2*z0-y0*z2) + (y0*z1-y1*z0);
565 const double c3 = -(x1*z2-x2*z1) - (x2*z0-x0*z2) - (x0*z1-x1*z0);
566 const double d3 = +(x1*y2-x2*y1) + (x2*y0-x0*y2) + (x0*y1-x1*y0);
567 const double s3 = iV6 * (a3 + b3*p.
x() + c3*p.
y() + d3*p.
z());
568 if (s3 < -1e-8)
return (
false);
574 template <
class INDEX>
578 if (this->
ni_ == 0 || this->
nj_ == 0)
return (
false);
581 if (node.i_ >= 0 && node.i_ < this->ni_ &&
582 node.j_ >= 0 && node.j_ < this->nj_)
589 "QuadSurfMesh::locate_node requires synchronize(NODE_LOCATE_E).")
601 if (bi > ni) bi =ni;
if (bi < 0) bi = 0;
602 if (bj > nj) bj =nj;
if (bj < 0) bj = 0;
603 if (bk > nk) bk =nk;
if (bk < 0) bk = 0;
609 double dmin = DBL_MAX;
620 if (i < 0 || i > ni)
continue;
623 if (j < 0 || j > nj)
continue;
626 if (k < 0 || k > nk)
continue;
627 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
629 if (
node_grid_->min_distance_squared(p, i, j, k) < dmin)
638 const double dist = (p-
point).length2();
659 while ((!found)||(dmin == DBL_MAX)) ;
665 template <
class INDEX>
669 "QuadSurfMesh::locate_node requires synchronize(EDGES_E).")
678 double mindist = 0.0;
684 if (!found || dist < mindist)
686 idx =
static_cast<INDEX
>(*bi);
696 template <
class INDEX>
702 "StructQuadSurfMesh::locate_node requires synchronize(ELEM_LOCATE_E).")
706 if ((elem > 0)&&(elem < sz))
709 if (
inside(elem,p))
return (
true);
721 elem =
static_cast<INDEX
>(*it);
731 template <
class INDEX,
class ARRAY>
737 "StructQuadSurfMesh::locate_node requires synchronize(ELEM_LOCATE_E).")
741 if ((elem > 0)&&(elem < sz))
747 this->
basis_.get_coords(coords,p,ed);
761 elem =
static_cast<INDEX
>(*it);
763 this->
basis_.get_coords(coords,p,ed);
772 template <
class ARRAY>
779 template <
class ARRAY>
785 if (this->ni_ < 2 || this->
nj_ < 2)
return (
false);
787 if (maxdist < 0.0) maxdist = DBL_MAX;
else maxdist = maxdist*maxdist;
790 if (elem.
i_ >= 0 && elem.
i_ < (this->ni_-1) &&
791 elem.
j_ >= 0 && elem.
j_ < (this->nj_-1))
798 points_(nodes[0].j_,nodes[0].i_),
799 points_(nodes[1].j_,nodes[1].i_),
800 points_(nodes[2].j_,nodes[2].i_),
801 points_(nodes[3].j_,nodes[3].i_));
803 double dist = (p-result).length2();
813 this->
basis_.get_coords(coords,result,ed);
815 result = this->
basis_.interpolate(coords,ed);
816 pdist = sqrt((result-p).length2());
822 "StructQuadSurfMesh::find_closest_elem requires synchronize(ELEM_LOCATE_E).")
834 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
835 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
836 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
838 ei = bi; ej = bj; ek = bk;
840 double dmin = maxdist;
842 bool found_one =
false;
856 if (i < 0 || i > ni)
continue;
859 if (j < 0 || j > nj)
continue;
862 if (k < 0 || k > nk)
continue;
863 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
865 if (
elem_grid_->min_distance_squared(p, i, j, k) < dmin)
876 points_(nodes[0].j_,nodes[0].i_),
877 points_(nodes[1].j_,nodes[1].i_),
878 points_(nodes[2].j_,nodes[2].i_),
879 points_(nodes[3].j_,nodes[3].i_));
880 const double dtmp = (p - r).length2();
897 this->
basis_.get_coords(coords,result,ed);
899 result = this->
basis_.interpolate(coords,ed);
900 dmin = (result-p).length2();
920 if (!found_one)
return (
false);
929 this->
basis_.get_coords(coords,result,ed);
931 result = this->
basis_.interpolate(coords,ed);
932 dmin = (result-p).length2();
948 static const std::string
type_name(
int n = -1);
1017 template <
class Basis>
1023 template <
class Basis>
1025 : synchronize_lock_(
"StructQuadSurfMesh Normals Lock"),
1026 synchronized_(
Mesh::ALL_ELEMENTS_E),
1038 template <
class Basis>
1040 :
ImageMesh<Basis>(x, y, Core::Geometry::
Point(0.0, 0.0, 0.0), Core::Geometry::
Point(1.0, 1.0, 1.0)),
1043 synchronize_lock_(
"StructQuadSurfMesh Normals Lock"),
1044 synchronized_(
Mesh::ALL_ELEMENTS_E),
1056 template <
class Basis>
1059 synchronize_lock_(
"StructQuadSurfMesh Normals Lock"),
1060 synchronized_(
Mesh::NODES_E |
Mesh::FACES_E |
Mesh::CELLS_E)
1064 copy.synchronize_lock_.lock();
1073 copy.synchronize_lock_.unlock();
1081 template <
class Basis>
1088 array.push_back(this->ni_);
1089 array.push_back(this->nj_);
1095 template <
class Basis>
1115 template <
class Basis>
1119 synchronize_lock_.lock();
1127 points_((*i).j_,(*i).i_) = t.
project(points_((*i).j_,(*i).i_));
1131 if (node_grid_) { node_grid_->transform(t); }
1132 if (elem_grid_) { elem_grid_->transform(t); }
1133 synchronize_lock_.unlock();
1137 template <
class Basis>
1142 result = normals_(idx.
j_, idx.
i_);
1146 template <
class Basis>
1151 result = points_(idx.
j_, idx.
i_);
1155 template <
class Basis>
1161 this->get_nodes(arr, idx);
1163 get_center(result, arr[0]);
1164 get_center(p1, arr[1]);
1171 template <
class Basis>
1177 this->get_nodes(nodes, idx);
1178 ASSERT(nodes.size() == 4);
1183 while (nai != nodes.end())
1185 get_point(pp, *nai);
1192 template <
class Basis>
1199 if (locate_elem(idx, p))
1210 template <
class Basis>
1217 if (locate_elem(idx, p))
1219 this->get_nodes(l,idx);
1220 std::vector<double> coords(2);
1221 if (get_coords(coords, p, idx)) {
1222 this->basis_.get_weights(coords, w);
1223 return this->basis_.dofs();
1230 template <
class Basis>
1236 this->get_nodes(nodes, i);
1240 std::vector<Core::Geometry::Point> pts(n);
1244 get_center(pts[i], nodes[i]);
1262 const double s = a0+a1+a2;
1275 if( std::fabs(s - a) < epsilon2_*epsilon2_ && a > epsilon2_*epsilon2_ )
1284 template <
class Basis>
1295 const double aarea =
Cross(a1 - a0, a2 - a0).
length();
1296 const double barea =
Cross(a3 - a0, a2 - a0).
length();
1301 if (u + v > 1.0) { u = 1.0 - u; v = 1.0 -
v; }
1303 if (rng() * (aarea + barea) < aarea)
1305 p = a0+((a1-a0)*u)+((a2-a0)*v);
1309 p = a0+((a3-a0)*u)+((a2-a0)*v);
1314 template <
class Basis>
1319 points_(index.
j_, index.
i_) = point;
1323 template <
class Basis>
1327 synchronize_lock_.lock();
1345 !(synchronized_ & Mesh::EPSILON_E))
1347 compute_epsilon(bb);
1352 !(synchronized_ & Mesh::NODE_LOCATE_E))
1354 compute_node_grid(bb);
1359 !(synchronized_ & Mesh::ELEM_LOCATE_E))
1361 compute_elem_grid(bb);
1365 synchronize_lock_.unlock();
1369 template <
class Basis>
1377 template <
class Basis>
1381 synchronize_lock_.lock();
1389 synchronize_lock_.unlock();
1393 template <
class Basis>
1406 elem_grid_->insert(idx, box);
1410 template <
class Basis>
1420 elem_grid_->remove(idx, box);
1424 template <
class Basis>
1430 node_grid_->insert(ni,points_[ni]);
1434 template <
class Basis>
1438 node_grid_->remove(ni,points_[ni]);
1441 template <
class Basis>
1453 ((ceil(pow(static_cast<double>(esz) , (1.0/3.0))))/2.0 + 1.0);
1456 double trace = (diag.
x()+diag.
y()+diag.
z());
1469 insert_node_into_grid(*ni);
1477 template <
class Basis>
1489 ((ceil(pow(static_cast<double>(esz) , (1.0/3.0))))/2.0 + 1.0);
1492 double trace = (diag.
x()+diag.
y()+diag.
z());
1505 insert_elem_into_grid(*ci);
1513 template <
class Basis>
1518 epsilon2_ = epsilon_*epsilon_;
1522 template <
class Basis>
1526 normals_.resize(points_.dim1(), points_.dim2());
1530 node_in_faces(points_.dim1(), points_.dim2());
1539 this->end(iter_end);
1540 while (iter != iter_end)
1542 this->get_nodes(nodes, *iter);
1545 get_point(p0, nodes[0]);
1546 get_point(p1, nodes[1]);
1547 get_point(p2, nodes[2]);
1548 get_point(p3, nodes[3]);
1551 node_in_faces(nodes[0].j_,nodes[0].i_).push_back(*iter);
1552 node_in_faces(nodes[1].j_,nodes[1].i_).push_back(*iter);
1553 node_in_faces(nodes[2].j_,nodes[2].i_).push_back(*iter);
1554 node_in_faces(nodes[3].j_,nodes[3].i_).push_back(*iter);
1559 face_normals((*iter).j_, (*iter).i_) =
n;
1566 this->begin( nif_iter );
1567 this->end( nif_iter_end );
1569 while (nif_iter != nif_iter_end)
1572 node_in_faces((*nif_iter).j_, (*nif_iter).i_);
1576 while(fiter != v.end())
1578 ave += face_normals((*fiter).j_,(*fiter).i_);
1582 normals_((*nif_iter).j_, (*nif_iter).i_) = ave;
1588 #define STRUCT_QUAD_SURF_MESH_VERSION 3
1590 template <
class Basis>
1602 Pio(stream, tpoints);
1604 size_t dim1 = tpoints.
dim1();
1605 size_t dim2 = tpoints.
dim2();
1607 points_.resize(dim2,dim1);
1608 for (
size_t i=0; i<dim1; i++)
1609 for (
size_t j=0; j<dim2; j++)
1610 points_(j,i) = tpoints(i,j);
1614 Pio(stream, points_);
1624 template <
class Basis>
1628 ASSERT((n >= -1) && n <= 1);
1636 static const std::string nm(
"StructQuadSurfMesh");
1646 template <
class Basis>
1657 std::string(__FILE__),
1665 template <
class Basis>
1666 const TypeDescription*
1673 template <
class Basis>
1683 std::string(__FILE__),
1691 template <
class Basis>
1701 std::string(__FILE__),
1709 template <
class Basis>
1719 std::string(__FILE__),
1727 template <
class Basis>
1737 std::string(__FILE__),
1745 template <
class Basis>
1749 double maxdist)
const
1752 if (this->ni_ == 0 || this->nj_ == 0)
return (
false);
1753 if (maxdist < 0.0) maxdist = DBL_MAX;
else maxdist = maxdist*maxdist;
1756 if (node.
i_ >= 0 && node.
i_ < this->ni_ &&
1757 node.
j_ >= 0 && node.
j_ < this->nj_)
1761 double dist = (point-p).length2();
1763 if ( dist < epsilon2_ )
1772 "StructQuadSurfMesh::find_closest_elem requires synchronize(NODELOCATE_E).")
1775 const size_type ni = node_grid_->get_ni()-1;
1776 const size_type nj = node_grid_->get_nj()-1;
1777 const size_type nk = node_grid_->get_nk()-1;
1781 node_grid_->unsafe_locate(bi, bj, bk, p);
1784 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
1785 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
1786 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
1788 ei = bi; ej = bj; ek = bk;
1792 double dmin = maxdist;
1794 bool found_one =
false;
1805 if (i < 0 || i > ni)
continue;
1808 if (j < 0 || j > nj)
continue;
1811 if (k < 0 || k > nk)
continue;
1812 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
1814 if (node_grid_->min_distance_squared(p, i, j, k) < dmin)
1823 const double dist = (p-pnt).length2();
1832 if (dmin < epsilon2_)
1851 if (!found_one)
return (
false);
1861 template <
class Basis>
1869 return(find_closest_elem(pdist,result,coords,elem,p,-1.0));
1873 template <
class Basis>
1883 if (this->ni_ < 2 || this->nj_ < 2)
return (
false);
1886 "StructQuadSurfMesh::find_closest_elem requires synchronize(ELEM_LOCATE_E).")
1889 const size_type ni = elem_grid_->get_ni()-1;
1890 const size_type nj = elem_grid_->get_nj()-1;
1891 const size_type nk = elem_grid_->get_nk()-1;
1895 elem_grid_->unsafe_locate(bi, bj, bk, p);
1898 if (bi > ni) bi = ni;
if (bi < 0) bi = 0;
1899 if (bj > nj) bj = nj;
if (bj < 0) bj = 0;
1900 if (bk > nk) bk = nk;
if (bk < 0) bk = 0;
1902 ei = bi; ej = bj; ek = bk;
1904 double dmin = DBL_MAX;
1918 if (i < 0 || i > ni)
continue;
1921 if (j < 0 || j > nj)
continue;
1924 if (k < 0 || k > nk)
continue;
1925 if (i == bi || i == ei || j == bj || j == ej || k == bk || k == ek)
1927 if (elem_grid_->min_distance_squared(p, i, j, k) < dmin)
1936 this->get_nodes(nodes,*it);
1938 points_(nodes[0].j_,nodes[0].i_),
1939 points_(nodes[1].j_,nodes[1].i_),
1940 points_(nodes[2].j_,nodes[2].i_),
1941 points_(nodes[3].j_,nodes[3].i_));
1942 const double dtmp = (p - r).length2();
1944 if (dtmp < dmin - epsilon2_)
1949 elems.push_back(*it);
1952 else if (dtmp < dmin + epsilon2_)
1954 elems.push_back(*it);
1967 while ((!found)||(dmin == DBL_MAX)) ;
1976 if (elems.size() == 1)
1982 this->basis_.get_coords(coords,result,ed);
1983 result = this->basis_.interpolate(coords,ed);
1984 dmin = (result-p).length2();
double jacobian_metric(const INDEX idx) const
Definition: StructQuadSurfMesh.h:492
std::vector< index_type > array_type
Definition: ImageMesh.h:278
void begin(typename Node::iterator &) const
Definition: ImageMesh.h:1543
index_type node0_index() const
the following designed to coordinate with ::get_nodes
Definition: StructQuadSurfMesh.h:271
bool reading() const
Definition: Persistent.h:164
void get_normal(Core::Geometry::Vector &result, std::vector< double > &coords, typename ImageMesh< Basis >::Elem::index_type eidx, unsigned int)
Definition: StructQuadSurfMesh.h:175
static const TypeDescription * face_type_description()
Definition: StructQuadSurfMesh.h:1711
bool locate(typename ImageMesh< Basis >::Elem::index_type &elem, ARRAY &coords, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:210
double get_epsilon() const
Definition: StructQuadSurfMesh.h:975
Definition: FieldRNG.h:37
std::string get_name(const std::string &type_sep_start="<", const std::string &type_sep_end="> ") const
Definition: TypeDescription.cc:135
Definition: StructQuadSurfMesh.h:259
virtual ~StructQuadSurfMesh()
Definition: StructQuadSurfMesh.h:111
void end(typename Node::iterator &) const
Definition: ImageMesh.h:1551
bool locate_edge(INDEX &idx, const Core::Geometry::Point &p) const
This is currently implemented as an exhaustive search.
Definition: StructQuadSurfMesh.h:666
Point max() const
Definition: BBox.h:195
bool get_coords(VECTOR &coords, const Core::Geometry::Point &p, typename ImageMesh< Basis >::Elem::index_type idx) const
Definition: StructQuadSurfMesh.h:367
#define ASSERTMSG(condition, message)
Definition: Exception.h:113
double get_length(typename ImageMesh< Basis >::Edge::index_type idx) const
Definition: StructQuadSurfMesh.h:165
static const TypeDescription * elem_type_description()
Definition: StructQuadSurfMesh.h:961
void compute_elem_grid(Core::Geometry::BBox &bb)
Definition: StructQuadSurfMesh.h:1479
size_type ni_
Definition: ImageMesh.h:942
void compute_epsilon(Core::Geometry::BBox &bb)
Definition: StructQuadSurfMesh.h:1515
void insert_node_into_grid(typename ImageMesh< Basis >::Node::index_type ci)
Definition: StructQuadSurfMesh.h:1426
index_type next(index_type i)
Definition: StructQuadSurfMesh.h:999
static const TypeDescription * edge_type_description()
Definition: StructQuadSurfMesh.h:1693
Definition: ImageMesh.h:61
bool locate(typename ImageMesh< Basis >::Cell::index_type &, const Core::Geometry::Point &) const
Definition: StructQuadSurfMesh.h:205
bool locate(typename ImageMesh< Basis >::Node::index_type &node, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:196
Definition: Persistent.h:89
SCIRun::index_type index_type
Definition: StructQuadSurfMesh.h:100
static const TypeDescription * cell_type_description()
Definition: StructQuadSurfMesh.h:1729
index_type edge3_index() const
Definition: StructQuadSurfMesh.h:310
Definition: ImageMesh.h:191
bool locate_elem(INDEX &elem, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:697
void get_nodes(typename Node::array_type &, typename Edge::index_type) const
get the child elements of the given index
Definition: ImageMesh.h:1155
virtual void transform(const Core::Geometry::Transform &t)
Definition: StructQuadSurfMesh.h:1117
void y(const double)
Definition: Point.h:135
void derivate(const VECTOR1 &coords, typename ImageMesh< Basis >::Elem::index_type idx, VECTOR2 &J) const
Definition: StructQuadSurfMesh.h:389
size_type j_
Definition: ImageMesh.h:119
Definition: Persistent.h:187
void lookup_ijk(iterator &begin, iterator &end, size_type i, size_type j, size_type k)
Definition: SearchGridT.h:207
BBox & extend(const Point &p)
Expand the bounding box to include point p.
Definition: BBox.h:98
void get_point(Core::Geometry::Point &point, const typename ImageMesh< Basis >::Node::index_type &index) const
Definition: StructQuadSurfMesh.h:249
void get_center(Core::Geometry::Point &, typename ImageMesh< Basis >::Cell::index_type) const
Definition: StructQuadSurfMesh.h:192
Definition: TypeDescription.h:50
const Core::Geometry::Point & node0() const
Definition: StructQuadSurfMesh.h:318
Definition: TypeDescription.h:45
#define SCISHARE
Definition: share.h:39
std::vector< const TypeDescription * > td_vec
Definition: TypeDescription.h:56
mask_type synchronized_
Definition: StructQuadSurfMesh.h:1009
Basis basis_
The basis class.
Definition: ImageMesh.h:951
boost::shared_ptr< Mesh > MeshHandle
Definition: DatatypeFwd.h:67
Array2< Core::Geometry::Point > points_
Definition: StructQuadSurfMesh.h:1002
bool find_closest_elems(double &pdist, Core::Geometry::Point &result, std::vector< typename ImageMesh< Basis >::Elem::index_type > &elems, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:1875
virtual bool synchronize(mask_type sync)
Definition: StructQuadSurfMesh.h:1325
friend class VStructQuadSurfMesh
Make sure the virtual interface has access.
Definition: StructQuadSurfMesh.h:95
unsigned int mask_type
Definition: Types.h:45
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, typename ImageMesh< Basis >::Elem::index_type &elem, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:1863
boost::shared_ptr< SearchGridT< typename ImageMesh< Basis >::Node::index_type > > node_grid_
normalized per node
Definition: StructQuadSurfMesh.h:1005
Point & asPoint() const
Definition: Vector.h:457
#define ASSERT(condition)
Definition: Assert.h:110
virtual int begin_class(const std::string &name, int current_version)
Definition: Persistent.cc:143
index_type prev(index_type i)
Definition: StructQuadSurfMesh.h:1000
boost::shared_ptr< VMesh > vmesh_
Virtual mesh.
Definition: ImageMesh.h:954
Definition: ImageMesh.h:124
size_t dim1() const
Returns number of rows.
Definition: Array2.h:97
index_type edge0_index() const
the following designed to coordinate with ::get_edges
Definition: StructQuadSurfMesh.h:294
double DetMatrix3P(const VectorOfPoints &p)
Inline templated determinant of matrix.
Definition: Locate.h:120
void get_random_point(Core::Geometry::Point &, const typename ImageMesh< Basis >::Elem::index_type &, FieldRNG &rng) const
Definition: StructQuadSurfMesh.h:1286
const string find_type_name(float *)
Definition: TypeName.cc:63
void z(const double)
Definition: Point.h:145
bool valid() const
Definition: BBox.h:93
void remove_elem_from_grid(typename ImageMesh< Basis >::Elem::index_type ci)
Definition: StructQuadSurfMesh.h:1412
double scaled_jacobian_metric(const INDEX idx) const
Definition: StructQuadSurfMesh.h:463
T DetMatrix3x3(const T *p)
Definition: Locate.h:95
bool find_closest_node(double &pdist, Core::Geometry::Point &result, typename ImageMesh< Basis >::Node::index_type &node, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:216
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, ARRAY &coords, typename ImageMesh< Basis >::Elem::index_type &elem, const Core::Geometry::Point &p, double maxdist) const
Definition: StructQuadSurfMesh.h:780
Definition: SearchGridT.h:47
const Core::Geometry::Point & node1() const
Definition: StructQuadSurfMesh.h:323
index_type node2_index() const
Definition: StructQuadSurfMesh.h:281
double get_volume(typename ImageMesh< Basis >::Cell::index_type) const
Definition: StructQuadSurfMesh.h:169
const char * name[]
Definition: BoostGraphExampleTests.cc:87
void x(const double)
Definition: Point.h:125
void est_closest_point_on_quad(Point &result, const Point &orig, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const double epsilon)
Definition: CompGeom.cc:226
VMesh * CreateVStructQuadSurfMesh(MESH *mesh)
Definition: StructQuadSurfMesh.h:76
SCIRun::mask_type mask_type
Definition: StructQuadSurfMesh.h:102
long long size_type
Definition: Types.h:40
bool clear_synchronization()
Definition: StructQuadSurfMesh.h:1379
ElemData(const StructQuadSurfMesh< Basis > &msh, const typename ImageMesh< Basis >::Elem::index_type ind)
Definition: StructQuadSurfMesh.h:263
Definition: StackVector.h:50
Vector Cross(const Vector &v1, const Vector &v2)
Definition: Vector.h:378
double ScaledDetMatrix3P(const VectorOfPoints &p)
Inline templated determinant of matrix.
Definition: Locate.h:132
void compute_normals()
Definition: StructQuadSurfMesh.h:1524
std::vector< index_type > array_type
Definition: ImageMesh.h:271
index_type node3_index() const
Definition: StructQuadSurfMesh.h:287
Vector diagonal() const
Definition: BBox.h:198
double get_size(typename ImageMesh< Basis >::Edge::index_type idx) const
Definition: StructQuadSurfMesh.h:142
static PersistentTypeID type_idsqs
Definition: StructQuadSurfMesh.h:946
Core::Thread::Mutex synchronize_lock_
Definition: StructQuadSurfMesh.h:1008
bool locate(typename ImageMesh< Basis >::Face::index_type &face, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:202
Array2< Core::Geometry::Vector > normals_
Definition: StructQuadSurfMesh.h:1003
size_type nj_
Definition: ImageMesh.h:943
void pwl_approx_edge(std::vector< std::vector< double > > &coords, typename ImageMesh< Basis >::Elem::index_type, unsigned which_edge, unsigned div_per_unit) const
Definition: StructQuadSurfMesh.h:352
virtual void io(Piostream &)
Export this class using the old Pio system.
Definition: ImageMesh.h:1479
static const std::string type_name(int n=-1)
Core functionality for getting the name of a templated mesh class.
Definition: StructQuadSurfMesh.h:1626
Point min() const
Definition: BBox.h:192
static MeshHandle structquadsurf_maker(size_type x, size_type y)
This function returns a handle for the virtual interface.
Definition: StructQuadSurfMesh.h:969
void x(double)
Definition: Vector.h:175
#define STRUCT_QUAD_SURF_MESH_VERSION
Definition: StructQuadSurfMesh.h:1588
double get_size(typename ImageMesh< Basis >::Cell::index_type) const
Definition: StructQuadSurfMesh.h:163
static const std::string make_template_id(const std::string &templateName, const std::string &templateParam)
Definition: TypeName.h:62
bool inside(INDEX idx, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:521
virtual Core::Geometry::BBox get_bounding_box() const
get the mesh statistics
Definition: StructQuadSurfMesh.h:1097
std::vector< index_type > array_type
Definition: ImageMesh.h:264
Declarations for virtual interface.
Definition: StructQuadSurfMesh.h:70
v
Definition: readAllFields.py:42
double normalize()
Definition: Vector.h:437
double get_size(const typename ImageMesh< Basis >::Face::index_type &idx) const
Definition: StructQuadSurfMesh.h:151
void get_center(Core::Geometry::Point &, const typename ImageMesh< Basis >::Node::index_type &) const
get the center point (in object space) of an element
Definition: StructQuadSurfMesh.h:1148
Definition: ImageMesh.h:136
boost::shared_ptr< SearchGridT< typename ImageMesh< Basis >::Elem::index_type > > elem_grid_
Definition: StructQuadSurfMesh.h:1006
Definition: ImageMesh.h:245
void compute_node_grid(Core::Geometry::BBox &bb)
Definition: StructQuadSurfMesh.h:1443
void y(double)
Definition: Vector.h:185
const Core::Geometry::Point & node3() const
Definition: StructQuadSurfMesh.h:333
void jacobian(const VECTOR &coords, typename ImageMesh< Basis >::Elem::index_type idx, double *J) const
Definition: StructQuadSurfMesh.h:413
index_type edge1_index() const
Definition: StructQuadSurfMesh.h:299
double safe_normalize()
Definition: Vector.h:236
double distance_to_line2(const Point &p, const Point &a, const Point &b, const double epsilon)
Definition: CompGeom.cc:53
Distinct type for edge Iterator.
Definition: FieldIterator.h:105
#define ASSERTFAIL(string)
Definition: Assert.h:52
bool locate(typename ImageMesh< Basis >::Edge::index_type &edge, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:199
int get_weights(const Core::Geometry::Point &, typename ImageMesh< Basis >::Cell::array_type &, double *)
Definition: StructQuadSurfMesh.h:240
void Pio(Piostream &stream, Array1< T > &array)
Definition: Array1.h:65
double det_jacobian(const VECTOR &coords, typename ImageMesh< Basis >::Elem::index_type idx) const
Definition: StructQuadSurfMesh.h:401
void size(typename Node::size_type &) const
Definition: ImageMesh.h:1559
bool locate_elem(INDEX &elem, ARRAY &coords, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:732
virtual int topology_geometry() const
Definition: StructQuadSurfMesh.h:134
double length() const
Definition: Vector.h:365
virtual void end_class()
Definition: Persistent.cc:178
StructQuadSurfMesh()
Definition: StructQuadSurfMesh.h:1024
void remove_node_from_grid(typename ImageMesh< Basis >::Node::index_type ci)
Definition: StructQuadSurfMesh.h:1436
long long index_type
Definition: Types.h:39
static MeshHandle mesh_maker()
This function returns a handle for the virtual interface.
Definition: StructQuadSurfMesh.h:967
size_type i_
Definition: ImageMesh.h:119
double epsilon_
Definition: StructQuadSurfMesh.h:1010
virtual const TypeDescription * get_type_description() const
Definition: StructQuadSurfMesh.h:1667
void insert_elem_into_grid(typename ImageMesh< Basis >::Elem::index_type ci)
Used to recompute data for individual cells.
Definition: StructQuadSurfMesh.h:1395
void resize(size_t size, const value_type &val=value_type())
Definition: StackVector.h:61
const Core::Geometry::Point & point(const typename ImageMesh< Basis >::Node::index_type &idx)
Definition: StructQuadSurfMesh.h:996
const ImageMesh * mesh_
Definition: ImageMesh.h:121
void set_point(const Core::Geometry::Point &point, const typename ImageMesh< Basis >::Node::index_type &index)
Definition: StructQuadSurfMesh.h:1316
double get_area(const typename ImageMesh< Basis >::Face::index_type &idx) const
Definition: StructQuadSurfMesh.h:167
void reset()
Definition: BBox.h:95
index_type edge2_index() const
Definition: StructQuadSurfMesh.h:304
boost::shared_ptr< StructQuadSurfMesh< Basis > > handle_type
Definition: StructQuadSurfMesh.h:104
Definition: Persistent.h:64
SCIRun::size_type size_type
Definition: ImageMesh.h:93
Definition: ImageMesh.h:238
SCIRun::mask_type mask_type
Definition: ImageMesh.h:94
virtual bool get_dim(std::vector< size_type > &) const
Definition: StructQuadSurfMesh.h:1083
virtual StructQuadSurfMesh * clone() const
Definition: StructQuadSurfMesh.h:109
Distinct type for edge index.
Definition: FieldIndex.h:81
int get_weights(const Core::Geometry::Point &, typename ImageMesh< Basis >::Edge::array_type &, double *)
Definition: StructQuadSurfMesh.h:235
int n
Definition: eab.py:9
size_t dim2() const
Returns number of cols.
Definition: Array2.h:101
T InverseMatrix3x3(const T *p, T *q)
Definition: Locate.h:47
bool inside3_p(typename ImageMesh< Basis >::Face::index_type i, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:1232
const Core::Geometry::Point & node4() const
Definition: StructQuadSurfMesh.h:338
Definition: ImageMesh.h:162
SCIRun::index_type under_type
Types that change depending on 32 or 64bits.
Definition: StructQuadSurfMesh.h:99
#define DEBUG_CONSTRUCTOR(type)
Definition: Debug.h:64
virtual void io(Piostream &)
Export this class using the old Pio system.
Definition: StructQuadSurfMesh.h:1592
double get_size(const typename ImageMesh< Basis >::Node::index_type &) const
Get the size of an element (length, area, volume)
Definition: StructQuadSurfMesh.h:140
Array2< Core::Geometry::Point > & get_points()
Definition: StructQuadSurfMesh.h:971
bool find_closest_elem(double &pdist, Core::Geometry::Point &result, ARRAY &coords, typename ImageMesh< Basis >::Elem::index_type &elem, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:773
double inverse_jacobian(const VECTOR &coords, typename ImageMesh< Basis >::Elem::index_type idx, double *Ji) const
Definition: StructQuadSurfMesh.h:438
void interpolate(Core::Geometry::Point &pt, const VECTOR &coords, typename ImageMesh< Basis >::Elem::index_type idx) const
Definition: StructQuadSurfMesh.h:377
void z(double)
Definition: Vector.h:195
static const TypeDescription * node_type_description()
Definition: StructQuadSurfMesh.h:1675
static Persistent * maker()
This function returns a maker for Pio.
Definition: StructQuadSurfMesh.h:965
void get_normal(Core::Geometry::Vector &, const typename ImageMesh< Basis >::Node::index_type &) const
Definition: StructQuadSurfMesh.h:1139
virtual void set_dim(std::vector< size_type > dims)
Definition: StructQuadSurfMesh.h:121
double epsilon2_
Definition: StructQuadSurfMesh.h:1011
int size
Definition: eabLatVolData.py:2
bool locate_node(INDEX &node, const Core::Geometry::Point &p) const
Definition: StructQuadSurfMesh.h:575
SCIRun::size_type size_type
Definition: StructQuadSurfMesh.h:101
#define DEBUG_DESTRUCTOR(type)
Definition: Debug.h:65
const TypeDescription * get_type_description(Core::Basis::ConstantBasis< T > *)
Definition: Constant.h:209
index_type node1_index() const
Definition: StructQuadSurfMesh.h:276
virtual bool unsynchronize(mask_type sync)
Definition: StructQuadSurfMesh.h:1371
Interface to dynamic 2D array class.
int get_weights(const Core::Geometry::Point &p, typename ImageMesh< Basis >::Node::array_type &l, double *w)
Definition: StructQuadSurfMesh.h:1212
bool elem_locate(INDEX &elem, MESH &msh, const Core::Geometry::Point &p)
General case locate, search each elem.
Definition: Mesh.h:188
const Core::Geometry::Point & node2() const
Definition: StructQuadSurfMesh.h:328