Ejemplo n.º 1
0
GaussQuadratureHexahedron::GaussQuadratureHexahedron(size_t order)
{
	GaussLegendre quadRule = GaussLegendre(order);

	m_order = std::min(quadRule.order(), std::min(quadRule.order(), quadRule.order()));
	m_numPoints = quadRule.size() * quadRule.size() * quadRule.size();
	position_type* pvPoint = new position_type[m_numPoints];
	weight_type* pvWeight = new weight_type[m_numPoints];

	size_t cnt  = 0;
	for(size_t i = 0; i < quadRule.size(); i ++) {
		for(size_t j = 0; j < quadRule.size(); j++) {
			for(size_t k = 0; k < quadRule.size(); k++, cnt++) {
				pvPoint[cnt][0] = quadRule.point(i)[0];
				pvPoint[cnt][1] = quadRule.point(j)[0];
				pvPoint[cnt][2] = quadRule.point(k)[0];
				pvWeight[cnt] = quadRule.weight(i) * quadRule.weight(j) * quadRule.weight(k);
			}
		}
	}
	m_pvPoint = pvPoint;
	m_pvWeight = pvWeight;
};
Ejemplo n.º 2
0
GaussQuadratureTriangle::GaussQuadratureTriangle(size_t order)
{
	GaussLegendre quadRule = GaussLegendre(order);
	GaussJacobi10 quadRule10 = GaussJacobi10(order);

	m_order = std::min(quadRule.order(), quadRule10.order());
	m_numPoints = quadRule10.size() * quadRule.size();
	position_type* pvPoint = new position_type[m_numPoints];
	weight_type* pvWeight = new weight_type[m_numPoints];

	size_t cnt = 0;
	for(size_t i = 0; i < quadRule.size(); i++){
		for(size_t j = 0; j < quadRule10.size(); j++, cnt++){
			pvPoint[cnt][0] = quadRule10.point(j)[0];
			pvPoint[cnt][1] = (1.0 - quadRule10.point(j)[0] ) * quadRule.point(i)[0];
			pvWeight[cnt] = quadRule.weight(i) * quadRule10.weight(j);
		}
	}
	m_pvPoint = pvPoint;
	m_pvWeight = pvWeight;
};