67 { ExtrudeMode::POLYMESH2D,
"polyMesh2D" },
68 { ExtrudeMode::MESHEDSURFACE,
"MeshedSurface" },
113int main(
int argc,
char *argv[])
117 "Create a 3D mesh from a 2D mesh by extruding with specified thickness"
138 runTimeExtruded.functionObjects().off();
140 const ExtrudeMode surfaceFormat = ExtrudeModeNames[
args[1]];
141 const bool overwrite =
args.found(
"overwrite");
143 Info<<
"Extruding from " << ExtrudeModeNames[surfaceFormat]
144 <<
" at time " << runTimeExtruded.timeName() <<
endl;
151 runTimeExtruded.system(),
170 if (surfaceFormat == MESHEDSURFACE)
176 labelList patchSizes(1, fMesh().nEdges() - fMesh().nInternalEdges());
178 const edgeList& edges = fMesh().edges();
181 if (!fMesh().isInternalEdge(edgeI))
183 edgeRegionMap.
insert(edges[edgeI], 0);
195 poly2DMesh.createMesh();
202 runTimeExtruded.constant(),
208 std::move(poly2DMesh.points()),
209 std::move(poly2DMesh.faces()),
210 std::move(poly2DMesh.owner()),
211 std::move(poly2DMesh.neighbour())
214 Info<<
"Constructing patches." <<
endl;
215 List<polyPatch*>
patches(poly2DMesh.patchNames().size());
221 poly2DMesh.patchNames()[patchi],
222 poly2DMesh.patchSizes()[patchi],
223 poly2DMesh.patchStarts()[patchi],
232 else if (surfaceFormat == POLYMESH2D)
239 runTimeExtruded.timeName(),
249 extruder.addFrontBackPatches();
253 extruder.setRefinement(meshMod());
258 mesh().updateMesh(morphMap());
267 const scalar mergeDim = 1
e-4 * bb.
minDim();
274 const edge&
e = edges[edgeI];
280 Info<<
"Merging edge " <<
e <<
" since length " << d
281 <<
" << " << mergeDim <<
nl;
284 collapsePointToLocation.set(
e[1],
points[
e[0]]);
288 List<pointEdgeCollapse> allPointInfo;
292 collapser.consistentCollapse
296 collapsePointToLocation,
303 collapser.setRefinement(allPointInfo, meshModCollapse);
307 = meshModCollapse.changeMesh(
mesh(),
false);
309 mesh().updateMesh(morphMap());
318 mesh().setInstance(
"constant");
322 Info<<
"\nWriting extruded mesh to time = " << runTimeExtruded.timeName()
Map from edge (expressed as its endpoints) to value. Hashing (and ==) on an edge is symmetric.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A HashTable to objects of type <T> with a label key.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word controlDictName
The default control dictionary name (normally "controlDict").
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A bounding box defined in terms of min/max extrema points.
scalar minDim() const
Smallest length/height/width dimension.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells ...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Given a 2D mesh insert all the topology changes to extrude. Does not work in parallel.
static autoPtr< extrudeModel > New(const dictionary &dict)
Select null constructed.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Calculates points shared by more than two processor patches or cyclic patches.
Convert a primitivePatch into a 2D polyMesh.
static word defaultRegion
Return the default region name.
A patch is a list of labels that address the faces in the global face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
const polyBoundaryMesh & patches
List< edge > edgeList
List of edge.
List< word > wordList
List of word.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
wordList patchNames(nPatches)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.