Commit 3f76bc7e authored by Max Lyon's avatar Max Lyon

add method to compute parmametric volume

parent e4e610a0
......@@ -2866,6 +2866,7 @@ void HexExtractor::sanitizeParametrization(bool snapBoundary, bool extremeTrunca
computeCellTypes();
HEXEX_DEBUG_ONLY(std::cout << "Total parametric volume is " << getTotalParametricVolume() << std::endl;)
}
bool HexExtractor::isInCell(CellHandle ch, Parameter param)
......@@ -3173,6 +3174,24 @@ std::vector<Parameter> HexExtractor::getParameters(HalfFaceHandle hfh, HalfEdgeH
return getParameters(inputMesh.incident_cell(hfh), vertices);
}
double HexExtractor::getParametricVolume(CellHandle ch)
{
auto params = getParameters(ch);
auto d1 = params[1] - params[0];
auto d2 = params[2] - params[0];
auto d3 = params[3] - params[0];
auto volume = 1.0 / 6.0 * dot(cross(d1, d2), d3);
return volume;
}
double HexExtractor::getTotalParametricVolume()
{
double volume = 0.0;
for (auto ch : inputMesh.cells())
volume += getParametricVolume(ch);
return volume;
}
Position HexExtractor::getPosition(Parameter param, CellHandle ch)
{
auto vertices = cellVertices[ch];
......@@ -4031,8 +4050,8 @@ void HexExtractor::calculateEdgeSingularity(EdgeHandle eh)
std::cout << "accumulated tran fun " << std::endl << accTranFun << std::endl;
for (auto vh : vertices)
{
std::cout << "face 1: " << parameter(inputMesh.incident_cell(transitionFace), vh) << " Cell is " << to_string(getCellType(inputMesh.incident_cell(transitionFace))) << std::endl;
std::cout << "face 2: " << parameter(currentCell, vh) << " Cell is " << to_string(getCellType(currentCell)) << std::endl;
std::cout << "face 1: " << parameter(inputMesh.incident_cell(transitionFace), vh) << " Cell is " << toString(getCellType(inputMesh.incident_cell(transitionFace))) << std::endl;
std::cout << "face 2: " << parameter(currentCell, vh) << " Cell is " << toString(getCellType(currentCell)) << std::endl;
}
......
......@@ -60,7 +60,7 @@ private:
Degenerate
};
std::string to_string(CellType type)
std::string toString(CellType type)
{
switch (type)
{
......@@ -629,6 +629,8 @@ private:
std::vector<Parameter> getParameters(CellHandle ch);
std::vector<Parameter> getParameters(HalfFaceHandle hfh);
std::vector<Parameter> getParameters(HalfFaceHandle hfh, HalfEdgeHandle heh);
double getParametricVolume(CellHandle ch);
double getTotalParametricVolume();
Position getPosition(Parameter param, CellHandle ch);
Parameter getParameter(Position pos, CellHandle ch);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment