-
Notifications
You must be signed in to change notification settings - Fork 287
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
Generic face element (crazy hack) #3521
Draft
dschwen
wants to merge
7
commits into
libMesh:devel
Choose a base branch
from
dschwen:generic_face
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
975eff1
generic face element
dschwen 84655a8
run rebuild scripts
dschwen efdcee8
rerun bootstrap
dschwen 2f6cfaa
add type and quadrature support bool
dschwen 19ef137
add clang-format rule
dschwen ad3b564
update string to enum
dschwen 5455d11
fixes
dschwen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DisableFormat: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,292 @@ | ||
// The libMesh Finite Element Library. | ||
// Copyright (C) 2002-2023 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner | ||
|
||
// This library is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
|
||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
|
||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
#ifndef LIBMESH_FACE_GENERIC_H | ||
#define LIBMESH_FACE_GENERIC_H | ||
|
||
// Local includes | ||
#include "libmesh/libmesh_common.h" | ||
#include "libmesh/face.h" | ||
|
||
namespace libMesh | ||
{ | ||
|
||
/** | ||
* The \p Generic element is an collection of nodes in 2D. No assumptions | ||
* about node connectivity are made. | ||
* | ||
* \author Daniel Schwen | ||
* \date 2023 | ||
* \brief The base class for all triangular element types. | ||
*/ | ||
class GenericFace : public Face | ||
{ | ||
public: | ||
|
||
/** | ||
* Generic 2D element, takes number of nodes and an optional | ||
* parent. Order and interpretation of the nodes is up to the user. | ||
*/ | ||
GenericFace(const unsigned int nn, Elem * p = nullptr) : Face(nn, 0, p, &_parent_link, nullptr) | ||
{ | ||
// copy nodes | ||
_nodelinks_data.resize(nn); | ||
_nodes = _nodelinks_data.data(); | ||
|
||
// Make sure the interior parent isn't undefined | ||
if (LIBMESH_DIM > 2) | ||
this->set_interior_parent(nullptr); | ||
} | ||
|
||
GenericFace (GenericFace &&) = delete; | ||
GenericFace (const GenericFace &) = delete; | ||
GenericFace & operator= (const GenericFace &) = delete; | ||
GenericFace & operator= (GenericFace &&) = delete; | ||
virtual ~GenericFace() = default; | ||
|
||
/** | ||
* \returns The \p Point associated with local \p Node \p i, | ||
* in master element rather than physical coordinates. | ||
*/ | ||
virtual Point master_point(const unsigned int /*i*/) const override final | ||
{ | ||
libmesh_error_msg("Generic 2d elements have no master points"); | ||
} | ||
|
||
/** | ||
* \returns 3. All tri-derivatives are guaranteed to have at | ||
* least 3 nodes. | ||
*/ | ||
virtual unsigned int n_nodes() const override { return _nodelinks_data.size(); } | ||
|
||
/** | ||
* \returns 0. | ||
*/ | ||
virtual unsigned int n_sides() const override final { return 0; } | ||
|
||
/** | ||
* \returns 3. All triangles have 3 vertices. | ||
*/ | ||
virtual unsigned int n_vertices() const override final { return n_nodes(); } | ||
|
||
/** | ||
* \returns 3. All triangles have 3 edges. | ||
*/ | ||
virtual unsigned int n_edges() const override final { libmesh_error_msg("Generic 2d elements do not have fixed edges"); } | ||
|
||
/** | ||
* \returns 4. | ||
*/ | ||
virtual unsigned int n_children() const override final { libmesh_error_msg("Generic 2d elements do not support adaptivity"); } | ||
|
||
/** | ||
* \returns \p true if the specified child is on the | ||
* specified side. | ||
*/ | ||
virtual bool is_child_on_side(const unsigned int /*c*/, | ||
const unsigned int /*s*/) const override final | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* Don't hide Elem::key() defined in the base class. | ||
*/ | ||
using Elem::key; | ||
|
||
/** | ||
* \returns An id associated with the \p s side of this element. | ||
* The id is not necessarily unique, but should be close. This is | ||
* particularly useful in the \p MeshBase::find_neighbors() routine. | ||
*/ | ||
virtual dof_id_type key(const unsigned int /*s*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* \returns An id associated with the global node ids of this | ||
* element. The id is not necessarily unique, but should be | ||
* close. | ||
*/ | ||
virtual dof_id_type key() const override final { libmesh_error_msg("not implemented"); } | ||
|
||
/** | ||
* \returns \p Tri3::side_nodes_map[side][side_node] after doing some range checking. | ||
*/ | ||
virtual unsigned int local_side_node(unsigned int /*side*/, | ||
unsigned int /*side_node*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* Calls local_side_node(edge, edge_node). For 2D elements, there is an implied | ||
* equivalence between edges and sides, e.g. n_edges() == n_sides(), so we treat | ||
* these two functions the same. | ||
*/ | ||
virtual unsigned int local_edge_node(unsigned int /*edge*/, | ||
unsigned int /*edge_node*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* \returns A primitive (2-noded) edge for edge i. | ||
*/ | ||
virtual std::unique_ptr<Elem> side_ptr(const unsigned int /*i*/) override final | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* Rebuilds an EDGE2 coincident with face i. | ||
*/ | ||
virtual void side_ptr(std::unique_ptr<Elem> & /*elem*/, const unsigned int /*i*/) override final | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* \returns A quantitative assessment of element quality based on | ||
* the quality metric \p q specified by the user. | ||
*/ | ||
virtual Real quality(const ElemQuality /*q*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* \returns The suggested quality bounds for the hex based on quality | ||
* measure \p q. These are the values suggested by the CUBIT User's | ||
* Manual. | ||
*/ | ||
virtual std::pair<Real, Real> qual_bounds(const ElemQuality /*q*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* Do not permute a generic element! | ||
*/ | ||
virtual unsigned int n_permutations() const override final { return 0; } | ||
|
||
virtual void orient(BoundaryInfo *) override final {} | ||
|
||
virtual ElemType type() const override { return GENERIC_FACE; } | ||
|
||
/** | ||
* \returns True if the element supports libmesh quadrature | ||
*/ | ||
virtual bool has_quadrature_support() const { return false; } | ||
|
||
virtual unsigned int n_sub_elem() const override { return 1; } | ||
|
||
virtual bool is_vertex(const unsigned int) const override { return false; } | ||
|
||
virtual bool is_edge(const unsigned int) const override { return false; } | ||
virtual bool is_face(const unsigned int) const override { return false; } | ||
|
||
virtual bool is_node_on_side(const unsigned int /*n*/, const unsigned int /*s*/) const override | ||
{ | ||
return false; | ||
} | ||
|
||
virtual std::vector<unsigned int> nodes_on_side(const unsigned int /*s*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
virtual std::vector<unsigned int> nodes_on_edge(const unsigned int /*e*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
virtual bool is_node_on_edge(const unsigned int /*n*/, const unsigned int /*e*/) const override | ||
{ | ||
return false; | ||
} | ||
|
||
virtual bool has_affine_map() const override { return true; } | ||
|
||
virtual bool has_invertible_map(Real /*tol*/) const override { return true; } | ||
|
||
virtual bool is_linear() const override { return true; } | ||
|
||
virtual Order default_order() const override { return FIRST; } | ||
|
||
virtual std::unique_ptr<Elem> build_side_ptr(const unsigned int /*i*/, | ||
bool /*proxy = false*/) override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* Rebuilds an EDGE2 coincident with face i. | ||
*/ | ||
virtual void build_side_ptr(std::unique_ptr<Elem> & /*elem*/, const unsigned int /*i*/) override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
virtual void connectivity(const unsigned int /*sf*/, | ||
const IOPackage /*iop*/, | ||
std::vector<dof_id_type> & /*conn*/) const override | ||
{ | ||
} | ||
|
||
virtual Point true_centroid() const override { libmesh_error_msg("not implemented"); } | ||
|
||
virtual Real volume() const override { libmesh_error_msg("not implemented"); } | ||
|
||
std::pair<Real, Real> min_and_max_angle() const { libmesh_error_msg("not implemented"); } | ||
|
||
virtual bool contains_point(const Point & /*p*/, Real /*tol*/) const override { return false; } | ||
|
||
// virtual BoundingBox loose_bounding_box() const override; | ||
|
||
virtual void permute(unsigned int /*perm_num*/) override final {} | ||
|
||
virtual void flip(BoundaryInfo *) override final {} | ||
|
||
ElemType side_type(const unsigned int /*s*/) const override final | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
/** | ||
* Matrix used to create the elements children. | ||
*/ | ||
virtual Real embedding_matrix(const unsigned int /*i*/, | ||
const unsigned int /*j*/, | ||
const unsigned int /*k*/) const override | ||
{ | ||
libmesh_error_msg("not implemented"); | ||
} | ||
|
||
protected: | ||
/** | ||
* node locations | ||
*/ | ||
std::vector<Node *> _nodelinks_data; | ||
|
||
Elem * _parent_link; | ||
}; | ||
|
||
} // namespace libMesh | ||
|
||
#endif // LIBMESH_FACE_GENERIC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.