I have made an example, archived in dupElemsSample.gid.zip, based on the cmas2d_customlib problemtype. It creates duplicate elements with the same element id.
In the following listings (in dupElemsSample.dat), eLement id 7, 8 and 9 are duplicated.
The QuadAndTri group contains 2 surefaces. See figure 2A.
The TriOnly group contains 1 surface; See figure 2B. The triangle face is intentionally included in 2 groups.
Using the cmas2d_customlib problemtype assignment feature, 2 materials (iron and aluminium) are assigned to 2 groups.
As a result, duplicate elements are created as shown above.
In order to avoid such problems, I think that the assignment using “layer” solves this problem.
See the figure 3. dupElemsSample.gid.zip (9.32 KB)
The customLib component is designed to work with GiD groups, not layers
just because Layers have the strong limitation that an entity can (in fact must) only belong to a layer,
this is not the case of the groups, an entity can belong to more of one group.
Can consider that a gid group is simply a named selection of geometry and/or mesh entities
The cmas2d_customlib is only a demo of how to create a problemtype adapted to a simulation solver.
The user must assign a ‘customLib material’ to each surface, in order to be taken into account for the calculation (in this case is a simple calculation of the mass center, considering density, and a post result with a scalar result with the distance of each mesh node to the calculated gravity center
The problemtype is not checking if the user not assigning material to all surfaces, or assigning more that one like your example. (a real code must do more error checks of course)
The .dat file is written by the problemtype Tcl proc, in this case
proc Cmas2d::WriteCalculationFile { filename }
it can write the data that exactly want, write repeated elements, write only once, return an error, etc.
in the current implementation if is assigned multiple times is writing multiple times.
Thank you for your reply. After reading your reply, I had an idea:
Please add a new feature that can automatically convert all “layers” to corresponding “groups”.
Background:
My main concern is to build a complicated 3D model from many volume geometries.
When assigning material properties to each volume geometry, the “overwrite” feature is useful.
For example, consider a dam model where the model contains concrete, water and rocks.
My approach is to first assign water to whole volume geometries,
and then change some of it to concrete and rock.
If there is an “overwrite” function, this method is useful if the model geometries are complex.
GiD “layer” includes “overwrite” feature but GiD “group” does not include “overwrite” feature.
So my idea is:
(1) First, build a model by assigning “layer” to each volume geometry.
(2) Second, create “groups” by converting “layer” to “group”.
Creating a “group” from a “layer” is easy within the GiD operation.
But if there are many “layers” in the model, repeating this conversion process each time is very tedious.
So if there is an automatic conversion feature from “layer” to “group”, it will be very helpful.
This feature already exists
in the layer window select the layers you want to create groups, and in the contextual menu select “Layers to groups”
(and in the groups tab there is the opposite, create layers from groups)
but take into account that are not the same kind of structure, the relation is not 1-1 always
Layers are generally used to facilitate the CAD edition of geometry, selection (e.g. to assign groups or other uses)
Groups are generally used to attach to the final geometry/mesh simulation data