diff --git a/applications/test/faces/Make/files b/applications/test/faces/Make/files new file mode 100644 index 0000000000..8418bb2b93 --- /dev/null +++ b/applications/test/faces/Make/files @@ -0,0 +1,3 @@ +Test-faces.C + +EXE = $(FOAM_USER_APPBIN)/Test-faces diff --git a/applications/test/faces/Make/options b/applications/test/faces/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/triSurface/tools/hashSignedLabel/hashSignedLabel.H b/applications/test/faces/Test-faces.C similarity index 55% rename from src/triSurface/tools/hashSignedLabel/hashSignedLabel.H rename to applications/test/faces/Test-faces.C index 992a820290..823f33e3e1 100644 --- a/src/triSurface/tools/hashSignedLabel/hashSignedLabel.H +++ b/applications/test/faces/Test-faces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,47 +21,64 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::hashSignedLabel +Application + Test-faces Description - hash for signed integers (Hash\ only works for unsigned ints) + Simple tests for various faces \*---------------------------------------------------------------------------*/ -#ifndef HashSignedLabel_H -#define HashSignedLabel_H +#include "argList.H" +#include "labelledTri.H" -#include "List.H" -#include "word.H" - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class hashSignedLabel Declaration -\*---------------------------------------------------------------------------*/ - -class hashSignedLabel -{ - -public: - - hashSignedLabel() - {} - - - label operator()(const label key, const label tableSize) const - { - return mag(key)%tableSize; - } -}; - -} // End namespace Foam +using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + face f1{ 1, 2, 3, 4 }; + Info<< "face:" << f1 << nl; + + triFace t1{ 1, 2, 3 }; + Info<< "triFace:" << t1 << nl; + + f1 = t1; + Info<< "face:" << f1 << nl; + + f1 = t1.triFaceFace(); + Info<< "face:" << f1 << nl; + + // expect these to fail + FatalError.throwExceptions(); + try + { + labelledTri l1{ 1, 2, 3, 10, 24 }; + Info<< "labelled:" << l1 << nl; + } + catch (Foam::error& err) + { + WarningInFunction + << "Caught FatalError " << err << nl << endl; + } + FatalError.dontThrowExceptions(); + + labelledTri l2{ 1, 2, 3 }; + Info<< "labelled:" << l2 << nl; + + labelledTri l3{ 1, 2, 3, 10 }; + Info<< "labelled:" << l3 << nl; + + t1.flip(); + l3.flip(); + + Info<< "flip:" << t1 << nl; + Info<< "flip:" << l3 << nl; + + return 0; +} -#endif // ************************************************************************* // - diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C index edb8527698..bc7d50f495 100644 --- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C +++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C @@ -41,6 +41,9 @@ Usage - \par -orient Check face orientation on the input surface + - \par -testModify + Test modification mechanism + - \par -scale \ Specify a scaling factor for writing the files @@ -65,6 +68,7 @@ Note #include "PackedBoolList.H" #include "MeshedSurfaces.H" +#include "ModifiableMeshedSurface.H" #include "UnsortedMeshedSurfaces.H" #include "IStringStream.H" @@ -93,6 +97,13 @@ int main(int argc, char *argv[]) "orient", "check surface orientation" ); + + argList::addBoolOption + ( + "testModify", + "Test modification mechanism (MeshedSurface)" + ); + argList::addBoolOption ( "surfMesh", @@ -389,6 +400,34 @@ int main(int argc, char *argv[]) Info<< endl; } + if (args.optionFound("testModify")) + { + Info<< "Use ModifiableMeshedSurface to shift (1, 0, 0)" << endl; + Info<< "original" << nl; + surf.writeStats(Info); + Info<< endl; + + ModifiableMeshedSurface tsurf(surf.xfer()); + // ModifiableMeshedSurface tsurf; + // tsurf.reset(surf.xfer()); + + Info<< "in-progress" << nl; + surf.writeStats(Info); + Info<< endl; + + tsurf.storedPoints() += vector(1, 0, 0); + + surf.transfer(tsurf); + + Info<< "updated" << nl; + surf.writeStats(Info); + Info<< endl; + + Info<< "modifier" << nl; + tsurf.writeStats(Info); + Info<< endl; + } + Info<< "writing " << exportName; if (scaleFactor <= 0) { diff --git a/etc/controlDict b/etc/controlDict index 9726a8b1ae..1334cc1bb1 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -794,7 +794,6 @@ DebugSwitches surfaceIntersection 0; surfaceNormalFixedValue 0; surfacePatch 0; - surfacePatchIOList 0; surfaceScalarField 0; surfaceScalarField::Internal 0; surfaceSlipDisplacement 0; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 8b6be8d895..a1650b7ee3 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -418,6 +418,7 @@ $(cellShape)/cellShapeIOList.C meshes/Identifiers/patch/patchIdentifier.C meshes/Identifiers/patch/coupleGroupIdentifier.C +meshes/Identifiers/surface/surfZoneIdentifier.C meshes/MeshObject/meshObject.C diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C similarity index 90% rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C index 0495598657..88c3f2d788 100644 --- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C +++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C @@ -97,14 +97,11 @@ Foam::surfZoneIdentifier::~surfZoneIdentifier() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::surfZoneIdentifier::write(Ostream& os) const { if (geometricType_.size()) { - os.writeKeyword("geometricType") - << geometricType_ - << token::END_STATEMENT << nl; + os.writeEntry("geometricType", geometricType_); } } @@ -112,7 +109,6 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // needed for list output - bool Foam::surfZoneIdentifier::operator!= ( const surfZoneIdentifier& rhs @@ -129,8 +125,9 @@ bool Foam::surfZoneIdentifier::operator== { return ( - name() == rhs.name() - && geometricType() == rhs.geometricType() + (index() == rhs.index()) + && (name() == rhs.name()) + && (geometricType() == rhs.geometricType()) ); } @@ -139,8 +136,7 @@ bool Foam::surfZoneIdentifier::operator== Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj) { - is >> obj.name_ - >> obj.geometricType_; + is >> obj.name_ >> obj.geometricType_; return is; } @@ -148,7 +144,8 @@ Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj) Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj) { - os << obj.name_ << ' ' << obj.geometricType_; + // newlines to separate, since that is what triSurface currently expects + os << nl << obj.name_ << nl << obj.geometricType_; os.check("Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"); return os; diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H similarity index 98% rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H index 3f6a1b9a77..ff75b56afa 100644 --- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H +++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H @@ -40,7 +40,6 @@ SourceFiles #include "word.H" #include "label.H" -#include "typeInfo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,7 +55,7 @@ Istream& operator>>(Istream&, surfZoneIdentifier&); Ostream& operator<<(Ostream&, const surfZoneIdentifier&); /*---------------------------------------------------------------------------*\ - Class surfZoneIdentifier Declaration + Class surfZoneIdentifier Declaration \*---------------------------------------------------------------------------*/ class surfZoneIdentifier diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifierList.H b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifierList.H similarity index 100% rename from src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifierList.H rename to src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifierList.H diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index 0504145ade..62ae47b3d0 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -155,8 +155,8 @@ public: //- Construct from list of labels explicit inline face(const labelUList&); - //- Construct from list of labels - explicit inline face(const labelList&); + //- Construct from an initializer list of labels + explicit inline face(std::initializer_list