copySurfaceParts.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  Finds feature edges and corners of a triangulated surface
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "argList.H"
30 #include "IFstream.H"
31 #include "fileName.H"
32 #include "triSurf.H"
33 #include "demandDrivenData.H"
34 
35 #include "triSurfaceCopyParts.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // Main program:
39 using namespace Foam;
40 
41 int main(int argc, char *argv[])
42 {
44  argList::validArgs.clear();
45  argList::validArgs.append("input surface file");
46  argList::validArgs.append("output surface file");
47  argList::validArgs.append("patch/subset name");
48  argList args(argc, argv);
49 
50  const fileName inFileName(args.args()[1]);
51  const fileName outFileName(args.args()[2]);
52 
53  if( outFileName == inFileName )
54  {
56  << "Output file " << outFileName
57  << " would overwrite the input file."
58  << exit(FatalError);
59  }
60 
61  wordList patches(1);
62  patches[0] = args.args()[3];
63 
64  triSurf originalSurface(inFileName);
65 
66  triSurfaceCopyParts copyPart(originalSurface);
67 
68  triSurf copy;
69 
70  copyPart.copySurface(patches, copy);
71 
72  copy.writeSurface(outFileName);
73 
74  Info << "End\n" << endl;
75 
76  return 0;
77 }
78 
79 
80 // ************************************************************************* //
Foam::argList::validArgs
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Definition: argList.H:143
triSurf.H
Foam::argList::args
const stringList & args() const
Return arguments.
Definition: argListI.H:66
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:97
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::argList::executable
const word & executable() const
Name of executable without the path.
Definition: argListI.H:30
Foam::Info
messageStream Info
argList.H
fileName.H
IFstream.H
Foam::FatalError
error FatalError
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::triSurfaceCopyParts
Definition: triSurfaceCopyParts.H:49
Foam::triSurf::writeSurface
void writeSurface(const fileName &) const
Definition: triSurf.C:430
patches
patches[0]
Definition: createSingleCellMesh.H:36
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::triSurfaceCopyParts::copySurface
void copySurface(const wordList &, triSurf &) const
copies selected patches/subsets to an already created mesh
Definition: triSurfaceCopyParts.C:285
Foam::argList::noParallel
static void noParallel()
Remove the parallel options.
Definition: argList.C:161
main
int main(int argc, char *argv[])
Definition: copySurfaceParts.C:41
args
Foam::argList args(argc, argv)
Foam::triSurf
Definition: triSurf.H:59
triSurfaceCopyParts.H