diff --git a/src/surfMesh/Make/files b/src/surfMesh/Make/files index 7c68022eb8..eac20cc94a 100644 --- a/src/surfMesh/Make/files +++ b/src/surfMesh/Make/files @@ -63,6 +63,7 @@ writers = writers $(writers)/surfaceWriter.C $(writers)/caching/surfaceWriterCaching.C +$(writers)/abaqus/abaqusSurfaceWriter.C $(writers)/boundaryData/boundaryDataSurfaceWriter.C $(writers)/ensight/ensightSurfaceWriter.C $(writers)/foam/foamSurfaceWriter.C diff --git a/src/surfMesh/writers/abaqus/abaqusSurfaceWriter.C b/src/surfMesh/writers/abaqus/abaqusSurfaceWriter.C new file mode 100644 index 0000000000..8932d90684 --- /dev/null +++ b/src/surfMesh/writers/abaqus/abaqusSurfaceWriter.C @@ -0,0 +1,355 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "abaqusSurfaceWriter.H" +#include "ABAQUSCore.H" +#include "IOmanip.H" +#include "ListOps.H" +#include "OSspecific.H" +#include "surfaceWriterMethods.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceWriters +{ + defineTypeName(abaqusWriter); + addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word); + addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, wordDict); +} +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Field writing implementation +#include "abaqusSurfaceWriterImpl.C" + +// Field writing methods +defineSurfaceWriterWriteFields(Foam::surfaceWriters::abaqusWriter); + + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Write connectivity as CSV list +inline static void writeConnectivity +( + Ostream& os, + const label elemId, + const labelUList& elem +) +{ + os << " " << elemId; + + for (const label vert : elem) + { + os << ", " << (vert + 1); + } + + os << nl; +} + +} // End namespace Foam + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::surfaceWriters::abaqusWriter::writeFace +( + Ostream& os, + const labelUList& f, + const label elemId, + const label propId, + bool header +) const +{ + // Only called with 3 or 4 points! + + if (header) + { + os << "*ELEMENT, TYPE=S" << f.size(); + + if (propId >= 0) + { + os << ", ELSET=_" << propId; + } + + os << nl; + } + + writeConnectivity(os, elemId, f); +} + + +void Foam::surfaceWriters::abaqusWriter::writeGeometry +( + Ostream& os, + const meshedSurf& surf, + labelList& decompOffsets, + DynamicList& decompFaces +) const +{ + const pointField& points = surf.points(); + const faceList& faces = surf.faces(); + const labelList& zones = surf.zoneIds(); + const labelList& elemIds = surf.faceIds(); + + // Possible to use faceIds? + bool useOrigFaceIds = + ( + elemIds.size() == faces.size() + && !ListOps::found(elemIds, lessOp1