1671 std::cerr <<
"Meshes don't have the same number of points or cells" 1677 std::vector<double> coord1 = mesh1->
getPoint(i);
1678 std::vector<double> coord2 = mesh2->
getPoint(i);
1679 for (
int j = 0; j < 3; ++j) {
1680 if (std::fabs((coord1[j] - coord2[j]) / coord2[j]) > tol) {
1681 std::cerr <<
"Meshes differ in point coordinates" << std::endl;
1682 std::cerr <<
"Index " << i <<
" Component " << j << std::endl;
1683 std::cerr <<
"Coord 1 " << std::setprecision(15) << coord1[j]
1684 <<
" Coord 2 " << std::setprecision(15) << coord2[j]
1686 std::cerr <<
"Meshes differ in point coordinates" << std::endl;
1693 std::vector<std::vector<double>> cell1 = mesh1->
getCellVec(i);
1694 std::vector<std::vector<double>> cell2 = mesh2->
getCellVec(i);
1695 if (cell1.size() != cell2.size()) {
1696 std::cerr <<
"Meshes differ in cells" << std::endl;
1699 for (
int j = 0; j < cell1.size(); ++j) {
1700 for (
int k = 0; k < 3; ++k) {
1701 if (std::fabs((cell1[j][k] - cell2[j][k]) / cell2[j][k]) > tol) {
1702 std::cerr <<
"Meshes differ in cells" << std::endl;
1713 int numArr1 = pd1->GetNumberOfArrays();
1714 int numArr2 = pd2->GetNumberOfArrays();
1716 if (numArr1 != numArr2) {
1717 std::cerr <<
"Meshes have different numbers of point data" << std::endl;
1718 std::cerr <<
"Mesh 1 has " << numArr1 << std::endl;
1719 std::cerr <<
"Mesh 2 has " << numArr2 << std::endl;
1723 for (
int i = 0; i < numArr1; ++i) {
1724 vtkDataArray *da1 = pd1->GetArray(i);
1725 std::cerr <<
"checking array " << da1->GetName() << std::endl;
1726 vtkDataArray *da2 = pd2->GetArray(pd1->GetArrayName(i));
1730 int numComponent = da1->GetNumberOfComponents();
1732 double *comps1 =
new double[numComponent];
1733 double *comps2 =
new double[numComponent];
1734 da1->GetTuple(j, comps1);
1735 da2->GetTuple(j, comps2);
1736 for (
int k = 0; k < numComponent; ++k) {
1737 da1->GetRange(range, k);
1738 abs_error = std::fabs(comps1[k] - comps2[k]);
1739 double max_val = std::max(std::abs(range[0]), std::abs(range[1]));
1740 rel_error = abs_error / std::max(1.0, max_val);
1741 if (rel_error > tol) {
1742 std::cerr <<
"For point data array " << da1->GetName() << std::endl;
1743 std::cerr <<
"Meshes differ in point data values at point " << j
1744 <<
" component " << k << std::endl;
1745 std::cerr << std::setprecision(15) <<
"Mesh 1 value : " << comps1[k]
1747 std::cerr << std::setprecision(15) <<
"Mesh 2 value : " << comps2[k]
1756 std::cerr <<
"Meshes are the same" << std::endl;
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
virtual std::vector< std::vector< double > > getCellVec(nemId_t id) const =0
get vector of coords of cell with id
vtkSmartPointer< vtkDataSet > getDataSet() const
get this meshes' dataSet
nemId_t getNumberOfPoints() const
return the number of points
nemId_t getNumberOfCells() const
return the number of cells
virtual std::vector< double > getPoint(nemId_t id) const =0
get point with id