Skip to content

Commit

Permalink
Prepare release.
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot-abi committed Mar 23, 2024
1 parent 3ebf837 commit c35eed4
Show file tree
Hide file tree
Showing 92 changed files with 3,041 additions and 1,478 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
CHANGE LOG: Zinc Library

v4.0.2
Python bindings infrastructure changes
v4.1.0
Fix optimisation with conditional field applying partially to elements' nodes.
Region read with single time is ignored with a warning for field value types not supporting time sequence.
Add mesh group API to add adjacent elements sharing faces/lines/points with elements currently in mesh group.
Fix define faces to match faces with same nodes, centroid and orientation, and better detect collapsed elements.
Add API to selectively remove subobject and subregion groups from group field.

v4.0.1
Fix group remove nodes/elements conditional
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(POLICY CMP0086)
endif()

# This is the project name and shows up in IDEs
project(Zinc VERSION 4.0.2 LANGUAGES C CXX)
project(Zinc VERSION 4.1.0 LANGUAGES C CXX)

# Set this to the development release or release candidate version.
set(Zinc_DEVELOPER_VERSION "")
Expand Down
52 changes: 52 additions & 0 deletions src/api/cmlibs/zinc/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,33 @@ ZINC_API int cmzn_element_get_dimension(cmzn_element_id element);
ZINC_API cmzn_elementfieldtemplate_id cmzn_element_get_elementfieldtemplate(
cmzn_element_id element, cmzn_field_id field, int componentNumber);

/**
* Get the number of faces for this element. This is how many faces its shape
* should have, irrespective of whether faces are defined or whether they are
* collapsed by a coordinate field.
* Note: 1-D line elements do not have faces and return 0 from this function.
*
* @param element The element to query.
* @return Number of faces for element's shape, including 0 if none, or -1
* if failed due to invalid element or if element shape is undefined.
*/
ZINC_API int cmzn_element_get_number_of_faces(cmzn_element_id element);

/**
* Get the face element of dimension one less than this element at the
* given face number. Can be NULL/invalid if faces have not been defined, if it
* has been destroyed, or is undefined due to being collapsed for the
* coordinate field used when defining faces.
* Face elements belong to the face mesh of this element's owning mesh.
*
* @param element The element to query.
* @param faceNumber The face number from 1 to number of faces.
* @return Handle to face element or NULL/invalid handle if none or invalid
* element or faceNumber is out of range.
*/
ZINC_API cmzn_element_id cmzn_element_get_face_element(cmzn_element_id element,
int faceNumber);

/**
* Returns the non-negative integer uniquely identifying the element in its
* mesh.
Expand Down Expand Up @@ -268,6 +295,31 @@ ZINC_API int cmzn_element_set_nodes_by_identifier(cmzn_element_id element,
cmzn_elementfieldtemplate_id eft, int identifiersCount,
const int *identifiersIn);

/**
* Get the number of parent elements for this element. This is the number of
* elements which reference this element as a face.
*
* @param element The element to query.
* @return Number of parent elements of this element, 0 if none, or -1 if
* element is invalid.
*/
ZINC_API int cmzn_element_get_number_of_parents(cmzn_element_id element);

/**
* Get a parent element of dimension one greater than this element at the given
* parent number. The ordering of parents gives the preferential order in which
* fields are inherited from parent elements, usually corresponding to the
* order in which faces were defined.
* Parent elements belong to the parent mesh of this element's owning mesh.
*
* @param element The element to query.
* @param parentNumber The parent number from 1 to number of parents.
* @return Handle to parent element or NULL/invalid handle if invalid element
* or parentNumber is out of range.
*/
ZINC_API cmzn_element_id cmzn_element_get_parent_element(cmzn_element_id element,
int parentNumber);

/**
* Get a scale factor for the element field template in element.
*
Expand Down
20 changes: 20 additions & 0 deletions src/api/cmlibs/zinc/element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ class Element
return Elementfieldtemplate(cmzn_element_get_elementfieldtemplate(this->id, field.getId(), componentNumber));
}

int getNumberOfFaces() const
{
return cmzn_element_get_number_of_faces(this->id);
}

Element getFaceElement(int faceNumber) const
{
return Element(cmzn_element_get_face_element(this->id, faceNumber));
}

int getIdentifier() const
{
return cmzn_element_get_identifier(id);
Expand Down Expand Up @@ -174,6 +184,16 @@ class Element
return cmzn_element_set_nodes_by_identifier(this->id, eft.getId(), identifiersCount, identifiersIn);
}

int getNumberOfParents() const
{
return cmzn_element_get_number_of_parents(this->id);
}

Element getParentElement(int parentNumber) const
{
return Element(cmzn_element_get_parent_element(this->id, parentNumber));
}

int getScaleFactor(const Elementfieldtemplate &eft, int scaleFactorIndex, double *valueOut) const
{
return cmzn_element_get_scale_factor(this->id, eft.getId(), scaleFactorIndex, valueOut);
Expand Down
4 changes: 2 additions & 2 deletions src/api/cmlibs/zinc/fieldassignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ ZINC_API cmzn_field_id cmzn_fieldassignment_get_conditional_field(
*
* @param fieldassignment The field assignment object to modify.
* @param conditionalField The conditional field to set, or invalid handle to
* clear. This is commonly a generic or node group field, but may be any field
* expression returning non-zero/true at domain locations of the target field
* clear. This is commonly a group field, but may be any field expression
* returning non-zero/true at domain locations of the target field
* where values are to be assigned, zero/false where no assignment is done.
* @return Result OK on success, otherwise ERROR_ARGUMENT.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/api/cmlibs/zinc/fieldfiniteelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ ZINC_API cmzn_field_id cmzn_fieldmodule_create_field_is_exterior(
* @return Handle to new field, or NULL/invalid handle on failure.
*/
ZINC_API cmzn_field_id cmzn_fieldmodule_create_field_is_on_face(
cmzn_fieldmodule_id fieldmodule, cmzn_element_face_type face);
cmzn_fieldmodule_id fieldmodule, enum cmzn_element_face_type face);

/**
* Cast field to 'is on face' type if valid.
Expand Down
42 changes: 36 additions & 6 deletions src/api/cmlibs/zinc/fieldgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,22 @@ ZINC_API int cmzn_field_group_clear(cmzn_field_group_id group);
*/
ZINC_API int cmzn_field_group_clear_local(cmzn_field_group_id group);

/**
* Remove and destroy all empty subobject groups (mesh and nodeset groups) of
* this group in this region.
* Subobject groups are not removed while external references are held to them.
*
* @param group Handle to group field to modify.
* @return CMZN_OK on success, CMZN_ERROR_ARGUMENT if invalid group.
*/
ZINC_API int cmzn_field_group_remove_empty_subobject_groups(
cmzn_field_group_id group);

/**
* Remove and destroy all empty subregion and subobject groups of this group.
* Empty subgroups in use by other clients may remain after call.
* Subobject groups are not removed while external references are held to them.
* Empty subregion groups in use by other clients will remain after call but
* outside this group.
*
* @param group Handle to group field to modify.
* @return Status CMZN_OK on success, any other value on failure.
Expand All @@ -120,8 +133,8 @@ ZINC_API int cmzn_field_group_remove_empty_subgroups(cmzn_field_group_id group);
/**
* Add the local/owning region of this group field to the group, i.e. all local
* objects/domains. This function is not hierarchical: subregions are not added.
* Note that subobject groups such as node and element groups attached to this
* group field are left intact by this function.
* Note that subobject groups such as nodeset and mesh groups within this group
* field are left intact by this function.
*
* @param group Handle to group field to modify.
* @return Status CMZN_OK on success, any other value on failure.
Expand All @@ -141,8 +154,8 @@ ZINC_API bool cmzn_field_group_contains_local_region(cmzn_field_group_id group);
/**
* Remove the local/owning region of this group field from the group, i.e. all local
* objects/domains. This function is not hierarchical: subregions are not removed.
* Note that subobject groups such as node and element groups attached to this
* group field are left intact by this function.
* Note that subobject groups such as nodeset and mesh groups within this group
* field are left intact by this function.
*
* @param group Handle to group field to modify.
* @return Status CMZN_OK on success, any other value on failure.
Expand Down Expand Up @@ -176,7 +189,8 @@ ZINC_API bool cmzn_field_group_contains_region(cmzn_field_group_id group, cmzn_r
/**
* Remove specified region from group if currently in it.
* The specified region must be in the tree of this group's local/owning region.
* This function is not hierarchical: subregions are not removed.
* This function effectively clears the local group in the region; its
* subregion groups are unchanged.
*
* @param group Handle to group field to modify.
* @param region Handle to region to be removed.
Expand Down Expand Up @@ -247,6 +261,22 @@ ZINC_API cmzn_field_group_id cmzn_field_group_get_subregion_field_group(cmzn_fie
ZINC_API cmzn_field_group_id cmzn_field_group_get_or_create_subregion_field_group(
cmzn_field_group_id group, cmzn_region_id subregion);

/**
* Remove subregion group field from this group.
* The subregion must be in the tree of this group's local/owning region.
* If the affected subregion group is in use by other clients it will remain
* unmodified after call but outside this group, otherwise it is destroyed.
*
* @param group Handle to group field to modify.
* @param subregion Handle to region to remove subgroup for, must be a
* descendent region of the owning group's region.
* @return CMZN_OK on success, CMZN_ERROR_ARGUMENT if bad arguments or
* subregion is not in group's region tree and below it, CMZN_ERROR_NOT_FOUND
* if subregion group not found.
*/
ZINC_API int cmzn_field_group_remove_subregion_field_group(
cmzn_field_group_id group, cmzn_region_id subregion);

/**
* Create a nodeset group in this group which holds nodes compatible with the
* supplied nodeset, if not already existing. Can create nodeset group for a
Expand Down
57 changes: 34 additions & 23 deletions src/api/cmlibs/zinc/fieldgroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,130 +49,141 @@ class FieldGroup : public Field

bool isEmpty() const
{
return cmzn_field_group_is_empty(getDerivedId());
return cmzn_field_group_is_empty(this->getDerivedId());
}

bool isEmptyLocal() const
{
return cmzn_field_group_is_empty_local(getDerivedId());
return cmzn_field_group_is_empty_local(this->getDerivedId());
}

int clear()
{
return cmzn_field_group_clear(getDerivedId());
return cmzn_field_group_clear(this->getDerivedId());
}

int clearLocal()
{
return cmzn_field_group_clear_local(getDerivedId());
return cmzn_field_group_clear_local(this->getDerivedId());
}

int removeEmptySubobjectGroups()
{
return cmzn_field_group_remove_empty_subobject_groups(this->getDerivedId());
}

int removeEmptySubgroups()
{
return cmzn_field_group_remove_empty_subgroups(getDerivedId());
return cmzn_field_group_remove_empty_subgroups(this->getDerivedId());
}

int addLocalRegion()
{
return cmzn_field_group_add_local_region(getDerivedId());
return cmzn_field_group_add_local_region(this->getDerivedId());
}

bool containsLocalRegion() const
{
return cmzn_field_group_contains_local_region(getDerivedId());
return cmzn_field_group_contains_local_region(this->getDerivedId());
}

int removeLocalRegion()
{
return cmzn_field_group_remove_local_region(getDerivedId());
return cmzn_field_group_remove_local_region(this->getDerivedId());
}

int addRegion(const Region& region)
{
return cmzn_field_group_add_region(getDerivedId(),
return cmzn_field_group_add_region(this->getDerivedId(),
region.getId());
}

int removeRegion(const Region& region)
{
return cmzn_field_group_remove_region(getDerivedId(), region.getId());
return cmzn_field_group_remove_region(this->getDerivedId(), region.getId());
}

bool containsRegion(const Region& region) const
{
return cmzn_field_group_contains_region(getDerivedId(), region.getId());
return cmzn_field_group_contains_region(this->getDerivedId(), region.getId());
}

SubelementHandlingMode getSubelementHandlingMode() const
{
return static_cast<SubelementHandlingMode>(
cmzn_field_group_get_subelement_handling_mode(getDerivedId()));
cmzn_field_group_get_subelement_handling_mode(this->getDerivedId()));
}

int setSubelementHandlingMode(SubelementHandlingMode mode)
{
return cmzn_field_group_set_subelement_handling_mode(getDerivedId(),
return cmzn_field_group_set_subelement_handling_mode(this->getDerivedId(),
static_cast<cmzn_field_group_subelement_handling_mode>(mode));
}

FieldGroup createSubregionFieldGroup(const Region& region)
{
return FieldGroup(cmzn_field_group_create_subregion_field_group(
getDerivedId(), region.getId()));
this->getDerivedId(), region.getId()));
}

FieldGroup getSubregionFieldGroup(const Region& region) const
{
return FieldGroup(cmzn_field_group_get_subregion_field_group(
getDerivedId(), region.getId()));
this->getDerivedId(), region.getId()));
}

FieldGroup getOrCreateSubregionFieldGroup(const Region& region)
{
return FieldGroup(cmzn_field_group_get_or_create_subregion_field_group(
getDerivedId(), region.getId()));
this->getDerivedId(), region.getId()));
}

int removeSubregionFieldGroup(const Region& subregion)
{
return cmzn_field_group_remove_subregion_field_group(
this->getDerivedId(), subregion.getId());
}

NodesetGroup createNodesetGroup(const Nodeset& nodeset)
{
return NodesetGroup(cmzn_field_group_create_nodeset_group(
getDerivedId(), nodeset.getId()));
this->getDerivedId(), nodeset.getId()));
}

NodesetGroup getNodesetGroup(const Nodeset& nodeset) const
{
return NodesetGroup(cmzn_field_group_get_nodeset_group(
getDerivedId(), nodeset.getId()));
this->getDerivedId(), nodeset.getId()));
}

NodesetGroup getOrCreateNodesetGroup(const Nodeset& nodeset) const
{
return NodesetGroup(cmzn_field_group_get_or_create_nodeset_group(
getDerivedId(), nodeset.getId()));
this->getDerivedId(), nodeset.getId()));
}

MeshGroup createMeshGroup(const Mesh& mesh)
{
return MeshGroup(cmzn_field_group_create_mesh_group(
getDerivedId(), mesh.getId()));
this->getDerivedId(), mesh.getId()));
}

MeshGroup getMeshGroup(const Mesh& mesh) const
{
return MeshGroup(cmzn_field_group_get_mesh_group(
getDerivedId(), mesh.getId()));
this->getDerivedId(), mesh.getId()));
}

MeshGroup getOrCreateMeshGroup(const Mesh& mesh) const
{
return MeshGroup(cmzn_field_group_get_or_create_mesh_group(
getDerivedId(), mesh.getId()));
this->getDerivedId(), mesh.getId()));
}

FieldGroup getFirstNonEmptySubregionFieldGroup() const
{
return FieldGroup(cmzn_field_group_get_first_non_empty_subregion_field_group(
getDerivedId()));
this->getDerivedId()));
}

};
Expand Down
Loading

0 comments on commit c35eed4

Please sign in to comment.