67 { ExtrudeMode::POLYMESH2D,
"polyMesh2D" },
68 { ExtrudeMode::MESHEDSURFACE,
"MeshedSurface" },
113 int main(
int argc,
char *argv[])
117 "Create a 3D mesh from a 2D mesh by extruding with specified thickness" 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;
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());
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]]);
292 collapser.consistentCollapse
296 collapsePointToLocation,
303 collapser.setRefinement(allPointInfo, meshModCollapse);
307 = meshModCollapse.changeMesh(
mesh(),
false);
322 Info<<
"\nWriting extruded mesh to time = " << runTimeExtruded.timeName()
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
void off()
Switch the function objects off.
constexpr char nl
The newline '\n' character (0x0a)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells ...
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
A bounding box defined in terms of min/max extrema points.
Ignore writing from objectRegistry::writeObject()
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
const dimensionedScalar e
Elementary charge.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
const functionObjectList & functionObjects() const noexcept
Return the list of function objects.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
static word defaultRegion
Return the default region name.
wordList patchNames(nPatches)
static word controlDictName
The default control dictionary name (normally "controlDict")
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
Convert a primitivePatch into a 2D polyMesh.
const fileName & rootPath() const noexcept
Return root path.
static autoPtr< extrudeModel > New(const dictionary &dict)
Select null constructed.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Calculates points shared by more than two processor patches or cyclic patches.
Given a 2D mesh insert all the topology changes to extrude. Does not work in parallel.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyBoundaryMesh & patches
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const boundBox & bounds() const noexcept
Return mesh bounding box.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
void addPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
scalar minDim() const
Smallest length/height/width dimension.
Do not request registration (bool: false)
bool found(const word &optName) const
Return true if the named option is found.
A HashTable to objects of type <T> with a label key.
static constexpr const zero Zero
Global zero (0)