Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set is_tensor_product_flag in Quadrature::initialize(..) #13729

Merged
merged 1 commit into from May 14, 2022

Conversation

simonsticko
Copy link
Contributor

@simonsticko simonsticko commented May 13, 2022

If you first create a quadrature which is a tensor product and then call initialize with points and weights which does not correspond to a tensor product, you can make is_tensor_product_flag have wrong value. Set the flag in intialize(..) to avoid this.

#include <deal.II/base/quadrature_lib.h>

using namespace dealii;

int
main()
{
  const int dim = 2;

  QGauss<dim> quadrature(2);

  std::vector<Point<dim>> arbirary_points(3);
  std::vector<double>     arbirary_weights(3);

  // Puts the tensor product flag in the wrong state.
  quadrature.initialize(arbirary_points, arbirary_weights);
  
  std::cout << quadrature.is_tensor_product() << std::endl;
}

Or would it be better to require that the quadrature is empty when initialize is called?

If you first create a quadrature which is a tensor product and then
call initialize with points and weights which does not correspond
to a tensor product, you can make is_tensor_product_flag have the
wrong value. Set the flag in intialize(..) to avoid this.
@simonsticko simonsticko changed the title Set is_tensor_product_flag to false in Quadrature::initialize(..) Set is_tensor_product_flag in Quadrature::initialize(..) May 13, 2022
@peterrum
Copy link
Member

/rebuild

@peterrum peterrum added the Bug label May 13, 2022
Copy link
Member

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I would have thought that Quadrature checks the points and sets the flag accordingly, but obviously this is not the case in the general case but just in the 1D setting.

Copy link
Member

@kronbichler kronbichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the present code.

@peterrum peterrum merged commit a95fabc into dealii:master May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants