Compare commits
56 Commits
feature-fv
...
feature-fo
| Author | SHA1 | Date | |
|---|---|---|---|
| e2e03fd70d | |||
| ad037ac744 | |||
| e3c93a9c85 | |||
| a2df607998 | |||
| e121db6e86 | |||
| e720f823d3 | |||
| bdac68ebc7 | |||
| edf9621ebe | |||
| a9863d9a3f | |||
| bdb890d4e2 | |||
| 707db0b65b | |||
| 8716795d86 | |||
| 8bbfe6eb44 | |||
| aaa9af9ee8 | |||
| 4de0b84c2f | |||
| db871856c0 | |||
| a01f3ed8b7 | |||
| c4b261c615 | |||
| 7b0ab0dbb3 | |||
| b9b0d1b3aa | |||
| 034a0524af | |||
| eaa65913f4 | |||
| 6dd8804acb | |||
| a77aaa7582 | |||
| 5cc36dc5b7 | |||
| d4a959a93f | |||
| 09e04003c4 | |||
| dcbd546d51 | |||
| d64c6371f1 | |||
| 2d246cd5d1 | |||
| 51bb06764a | |||
| 795bce4519 | |||
| db0709f957 | |||
| 38e08fc092 | |||
| 36ae93d017 | |||
| ab7cfdcf49 | |||
| f13be4f62c | |||
| ae638c2b9c | |||
| 9cd0aa8816 | |||
| 939ca03495 | |||
| 28818c73f9 | |||
| 20b2f46315 | |||
| 5d9f8e9a9d | |||
| 3bf1399098 | |||
| 20b6aeb4dd | |||
| c7fc9d4ddc | |||
| f0b844eb47 | |||
| 151f4df546 | |||
| 7ac83f22c7 | |||
| 8c395357f3 | |||
| d4b5280742 | |||
| be30598e3d | |||
| d64682a7af | |||
| cf9fa16788 | |||
| 9437e8d068 | |||
| dd09aa1289 |
@ -1,2 +1,2 @@
|
||||
api=2412
|
||||
api=2501
|
||||
patch=0
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -679,7 +679,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
}
|
||||
}
|
||||
|
||||
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
|
||||
scalar totalQ = gWeightedSum(mesh_.V(), Q_.primitiveField());
|
||||
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
||||
|
||||
if (mesh_.time().writeTime())
|
||||
|
||||
@ -51,17 +51,20 @@ Description
|
||||
//- Mapping of some fundamental and aggregate types to MPI data types
|
||||
enum class dataTypes : int
|
||||
{
|
||||
// Builtin Types [8]:
|
||||
DataTypes_begin, //!< Begin builtin types (internal use)
|
||||
type_byte = DataTypes_begin, // also for char, unsigned char
|
||||
// Fundamental Types [10]:
|
||||
Basic_begin,
|
||||
type_byte = Basic_begin,
|
||||
type_int16,
|
||||
type_int32,
|
||||
type_int64,
|
||||
type_uint16,
|
||||
type_uint32,
|
||||
type_uint64,
|
||||
type_float,
|
||||
type_double,
|
||||
type_long_double,
|
||||
invalid
|
||||
invalid,
|
||||
Basic_end = invalid
|
||||
};
|
||||
|
||||
|
||||
@ -69,20 +72,19 @@ enum class dataTypes : int
|
||||
|
||||
// Partial copy from UPstreamTraits.H
|
||||
|
||||
//- A supported UPstream data type (intrinsic or user-defined)
|
||||
//- UPstream data type corresponding to an intrinsic (MPI) type
|
||||
template<class T>
|
||||
struct UPstream_base_dataType : std::false_type
|
||||
struct UPstream_mpi_dataType : std::false_type
|
||||
{
|
||||
static constexpr auto datatype_id = dataTypes::invalid;
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Specializations of the above,
|
||||
// each to match the elements of UPstream::dataTypes
|
||||
|
||||
// Specializations to match elements of UPstream::dataTypes
|
||||
#undef defineUPstreamDataTraits
|
||||
#define defineUPstreamDataTraits(TypeId, Type) \
|
||||
template<> struct UPstream_base_dataType<Type> : std::true_type \
|
||||
template<> struct UPstream_mpi_dataType<Type> : std::true_type \
|
||||
{ \
|
||||
static constexpr auto datatype_id = dataTypes::TypeId; \
|
||||
};
|
||||
@ -90,8 +92,10 @@ struct UPstream_base_dataType : std::false_type
|
||||
|
||||
defineUPstreamDataTraits(type_byte, char);
|
||||
defineUPstreamDataTraits(type_byte, unsigned char);
|
||||
defineUPstreamDataTraits(type_int16, int16_t);
|
||||
defineUPstreamDataTraits(type_int32, int32_t);
|
||||
defineUPstreamDataTraits(type_int64, int64_t);
|
||||
defineUPstreamDataTraits(type_uint16, uint16_t);
|
||||
defineUPstreamDataTraits(type_uint32, uint32_t);
|
||||
defineUPstreamDataTraits(type_uint64, uint64_t);
|
||||
defineUPstreamDataTraits(type_float, float);
|
||||
@ -109,8 +113,8 @@ struct UPstream_alias_dataType
|
||||
:
|
||||
std::bool_constant
|
||||
<
|
||||
// Base type (no alias needed)
|
||||
UPstream_base_dataType<std::remove_cv_t<T>>::value ||
|
||||
// Basic MPI type
|
||||
UPstream_mpi_dataType<std::remove_cv_t<T>>::value ||
|
||||
(
|
||||
// Or some int 32/64 type to re-map
|
||||
std::is_integral_v<T>
|
||||
@ -118,15 +122,11 @@ struct UPstream_alias_dataType
|
||||
)
|
||||
>
|
||||
{
|
||||
// Is it using the base type? (no alias needed)
|
||||
static constexpr bool is_base =
|
||||
UPstream_base_dataType<std::remove_cv_t<T>>::value;
|
||||
|
||||
using base = std::conditional_t
|
||||
<
|
||||
UPstream_base_dataType<std::remove_cv_t<T>>::value, // is_base
|
||||
std::remove_cv_t<T>,
|
||||
std::conditional_t
|
||||
UPstream_mpi_dataType<std::remove_cv_t<T>>::value,
|
||||
std::remove_cv_t<T>, // <- using mpi type (no alias)
|
||||
std::conditional_t // <- using alias
|
||||
<
|
||||
(
|
||||
std::is_integral_v<T>
|
||||
@ -138,12 +138,32 @@ struct UPstream_alias_dataType
|
||||
std::conditional_t<std::is_signed_v<T>, int32_t, uint32_t>,
|
||||
std::conditional_t<std::is_signed_v<T>, int64_t, uint64_t>
|
||||
>,
|
||||
char // Fallback value (assuming it is contiguous)
|
||||
char // Fallback is a byte (eg, arbitrary contiguous data)
|
||||
>
|
||||
>;
|
||||
|
||||
static constexpr auto datatype_id =
|
||||
UPstream_base_dataType<base>::datatype_id;
|
||||
UPstream_mpi_dataType<base>::datatype_id;
|
||||
};
|
||||
|
||||
|
||||
// Handle int8_t/uint8_t as aliases since 'signed char' etc may be
|
||||
// ambiguous
|
||||
|
||||
//- Map \c int8_t to UPstream::dataTypes::type_byte
|
||||
template<>
|
||||
struct UPstream_alias_dataType<int8_t> : std::true_type
|
||||
{
|
||||
using base = char;
|
||||
static constexpr auto datatype_id = dataTypes::type_byte;
|
||||
};
|
||||
|
||||
//- Map \c uint8_t to UPstream::dataTypes::type_byte
|
||||
template<>
|
||||
struct UPstream_alias_dataType<uint8_t> : std::true_type
|
||||
{
|
||||
using base = unsigned char;
|
||||
static constexpr auto datatype_id = dataTypes::type_byte;
|
||||
};
|
||||
|
||||
|
||||
@ -172,25 +192,30 @@ void print(const char* name, bool showLimits = true)
|
||||
}
|
||||
|
||||
// A declared or deduced MPI type, or aliased
|
||||
std::cout
|
||||
<< " is_mpi=" << UPstream_base_dataType<T>::value
|
||||
<< " (" << int(UPstream_base_dataType<T>::datatype_id) << ")";
|
||||
|
||||
if (UPstream_alias_dataType<T>::value)
|
||||
if constexpr (UPstream_mpi_dataType<T>::value)
|
||||
{
|
||||
if (UPstream_alias_dataType<T>::is_base)
|
||||
{
|
||||
std::cout<< " is_base";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<< " is_alias ("
|
||||
<< int(UPstream_alias_dataType<T>::datatype_id) << ")";
|
||||
}
|
||||
std::cout
|
||||
<< " is_mpi=("
|
||||
<< int(UPstream_mpi_dataType<T>::datatype_id) << ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<< " no_alias";
|
||||
std::cout << " is_mpi=(null)";
|
||||
}
|
||||
|
||||
// Any aliases?
|
||||
if constexpr (UPstream_alias_dataType<T>::value)
|
||||
{
|
||||
if constexpr (UPstream_mpi_dataType<T>::value)
|
||||
{
|
||||
std::cout << " alias=base";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout
|
||||
<< " alias=("
|
||||
<< int(UPstream_alias_dataType<T>::datatype_id) << ')';
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<< '\n';
|
||||
@ -217,6 +242,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::cout << '\n';
|
||||
print<char>("char");
|
||||
print<signed char>("signed char");
|
||||
print<unsigned char>("unsigned char");
|
||||
print<short>("short");
|
||||
print<int>("int");
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-HashTable1.C
|
||||
Test-HashTable1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable1
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -74,15 +74,11 @@ Ostream& toString(Ostream& os, const List<char>& list)
|
||||
void printTokens(Istream& is)
|
||||
{
|
||||
label count = 0;
|
||||
token t;
|
||||
while (is.good())
|
||||
|
||||
Info<< "stream tokens:" << endl;
|
||||
for (token tok; tok.read(is); ++count)
|
||||
{
|
||||
is >> t;
|
||||
if (t.good())
|
||||
{
|
||||
++count;
|
||||
Info<< "token: " << t << endl;
|
||||
}
|
||||
Info<< " : " << tok << endl;
|
||||
}
|
||||
|
||||
Info<< count << " tokens" << endl;
|
||||
@ -455,6 +451,12 @@ int main(int argc, char *argv[])
|
||||
"( const char input \"string\" to tokenize )\n"
|
||||
"List<label> 5(0 1 2 3 4);";
|
||||
|
||||
// printTokens
|
||||
{
|
||||
ISpanStream is(charInput);
|
||||
printTokens(is);
|
||||
}
|
||||
|
||||
string stringInput("( string ; input \"string\" to tokenize )");
|
||||
|
||||
List<char> listInput
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-IjkField.C
|
||||
Test-IjkField.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-IjkField
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-List2.C
|
||||
Test-List2.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-List2
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,6 +35,7 @@ Description
|
||||
#include "FixedList.H"
|
||||
#include "labelList.H"
|
||||
#include "vectorList.H"
|
||||
#include "SubList.H"
|
||||
#include "ListOps.H"
|
||||
#include "IFstream.H"
|
||||
#include "OFstream.H"
|
||||
@ -200,6 +201,7 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption("order");
|
||||
argList::addBoolOption("labelList");
|
||||
argList::addBoolOption("vectorList");
|
||||
argList::addBoolOption("ulist");
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
@ -261,6 +263,37 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (args.found("ulist"))
|
||||
{
|
||||
using span_type = stdFoam::span<vector>;
|
||||
using ulist_type = UList<vector>;
|
||||
|
||||
ulist_type view1, view2;
|
||||
span_type span1, span2;
|
||||
|
||||
List<vector> list(10, vector::one);
|
||||
|
||||
Info<< "List: " << Foam::name(list.data()) << nl;
|
||||
Info<< "view: " << Foam::name(view1.data()) << nl;
|
||||
Info<< "span: " << Foam::name(span1.data()) << nl;
|
||||
|
||||
view1 = list.slice(4);
|
||||
span1 = span_type(list.begin(4), list.size()-4);
|
||||
Info<< "view [4]:" << Foam::name(view1.data()) << nl;
|
||||
Info<< "span [4]:" << Foam::name(span1.data()) << nl;
|
||||
|
||||
view2 = std::move(view1);
|
||||
span2 = std::move(span1);
|
||||
Info<< "view old:" << Foam::name(view1.data()) << nl;
|
||||
Info<< "span old:" << Foam::name(span1.data()) << nl;
|
||||
Info<< "view [4]:" << Foam::name(view2.data()) << nl;
|
||||
Info<< "span [4]:" << Foam::name(span2.data()) << nl;
|
||||
|
||||
view1 = list.slice(7);
|
||||
Info<< "view [7]:" << Foam::name(view1.data()) << nl;
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Done" << nl << endl;
|
||||
return 0;
|
||||
}
|
||||
@ -37,35 +37,40 @@ Description
|
||||
#include "vector.H"
|
||||
#include "tensor.H"
|
||||
#include "uLabel.H"
|
||||
#include "MinMax.H"
|
||||
#include "Switch.H"
|
||||
#include "IOstreams.H"
|
||||
#include "UPstream.H"
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Just for debugging
|
||||
const List<std::string> dataType_names
|
||||
({
|
||||
"byte",
|
||||
"int32",
|
||||
"int64",
|
||||
"uint32",
|
||||
"uint64",
|
||||
"float",
|
||||
"double",
|
||||
"long_double",
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Add in some extras from functional
|
||||
|
||||
//- Map std::plus to \c UPstream::opCodes::op_sum
|
||||
template<>
|
||||
struct UPstream_opType<std::plus<void>> : std::true_type
|
||||
{
|
||||
static constexpr auto opcode_id = UPstream::opCodes::op_sum;
|
||||
};
|
||||
|
||||
|
||||
//- Map 'signed char' to UPstream::dataTypes::type_byte
|
||||
// Caution with: may be identical to int8_t mapping!!
|
||||
#if 0
|
||||
template<>
|
||||
struct UPstream_alias_dataType<signed char> : std::true_type
|
||||
{
|
||||
using base = char;
|
||||
static constexpr auto datatype_id = UPstream::dataTypes::type_byte;
|
||||
};
|
||||
#endif
|
||||
|
||||
"float(2)",
|
||||
"double(2)",
|
||||
"float(3)",
|
||||
"double(3)",
|
||||
"float(6)",
|
||||
"double(6)",
|
||||
"float(9)",
|
||||
"double(9)"
|
||||
});
|
||||
|
||||
//- Test for pTraits typeName member : default is false
|
||||
template<class T, class = void>
|
||||
@ -82,24 +87,93 @@ struct check_has_typeName
|
||||
std::true_type
|
||||
{};
|
||||
|
||||
|
||||
// Possible future change...
|
||||
// //- A supported UPstream data type (intrinsic or user-defined)
|
||||
// template<>
|
||||
// struct UPstream_base_dataType<complex> : std::true_type
|
||||
// {
|
||||
// static constexpr auto datatype_id = []()
|
||||
// {
|
||||
// if constexpr (sizeof(complex) == 2*sizeof(float))
|
||||
// return UPstream::dataTypes::type_2float;
|
||||
// else
|
||||
// return UPstream::dataTypes::type_2double;
|
||||
// }();
|
||||
// };
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
template<class T>
|
||||
void printTypeName(const bool showSize = false)
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Just for debugging
|
||||
static const Foam::List<std::string> dataType_names
|
||||
({
|
||||
"byte",
|
||||
"int16",
|
||||
"int32",
|
||||
"int64",
|
||||
"uint16",
|
||||
"uint32",
|
||||
"uint64",
|
||||
"float",
|
||||
"double",
|
||||
"long_double",
|
||||
|
||||
"float[3]",
|
||||
"double[3]",
|
||||
"float[6]",
|
||||
"double[6]",
|
||||
"float[9]",
|
||||
"double[9]"
|
||||
});
|
||||
|
||||
// Just for debugging
|
||||
static const Foam::List<std::string> opType_names
|
||||
({
|
||||
"op_min",
|
||||
"op_max",
|
||||
"op_sum",
|
||||
"op_prod",
|
||||
"op_bool_and",
|
||||
"op_bool_or",
|
||||
"op_bool_xor",
|
||||
"op_bit_and",
|
||||
"op_bit_or",
|
||||
"op_bit_xor",
|
||||
"op_replace",
|
||||
"op_no_op"
|
||||
});
|
||||
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void printDataTypeId(UPstream::dataTypes datatype_id)
|
||||
{
|
||||
if (datatype_id != UPstream::dataTypes::invalid)
|
||||
{
|
||||
const int index = int(datatype_id);
|
||||
if (index < dataType_names.size())
|
||||
{
|
||||
Info<< dataType_names[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< '(' << index << ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printOpCodeId(UPstream::opCodes opcode_id)
|
||||
{
|
||||
if (opcode_id != UPstream::opCodes::invalid)
|
||||
{
|
||||
const int index = int(opcode_id);
|
||||
if (index < opType_names.size())
|
||||
{
|
||||
Info<< ':' << opType_names[index].c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< '(' << index << ')';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "(null)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, bool showSize = false>
|
||||
void printTypeName()
|
||||
{
|
||||
// Both float and double have pTraits typeName = "scalar"!
|
||||
if constexpr (std::is_same_v<float, std::remove_cv_t<T>>)
|
||||
@ -118,12 +192,13 @@ void printTypeName(const bool showSize = false)
|
||||
{
|
||||
Info<< typeid(T).name();
|
||||
}
|
||||
if (showSize)
|
||||
if constexpr (showSize)
|
||||
{
|
||||
Info<< " (" << sizeof(T) << " bytes)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, bool UseTypeName = true>
|
||||
void printPstreamTraits(const std::string_view name = std::string_view())
|
||||
{
|
||||
@ -133,55 +208,111 @@ void printPstreamTraits(const std::string_view name = std::string_view())
|
||||
{
|
||||
Info<< name << ' ';
|
||||
}
|
||||
|
||||
if constexpr (UseTypeName)
|
||||
{
|
||||
printTypeName<Type>(true);
|
||||
printTypeName<Type, true>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< typeid(Type).name();
|
||||
Info<< " (" << sizeof(Type) << " bytes)";
|
||||
Info<< typeid(Type).name() << " (" << sizeof(Type) << " bytes)";
|
||||
}
|
||||
|
||||
{
|
||||
using cmpt = typename Foam::pTraits_cmptType<Type>::type;
|
||||
|
||||
if constexpr (!std::is_same_v<Type, cmpt>)
|
||||
{
|
||||
Info<< ", cmpt:";
|
||||
|
||||
if constexpr (UseTypeName)
|
||||
{
|
||||
printTypeName<cmpt, true>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< typeid(cmpt).name() << " (" << sizeof(cmpt) << " bytes)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< ", cmpt:";
|
||||
printTypeName<typename Foam::pTraits_cmptType<Type>::type>(true);
|
||||
|
||||
Info<< nl
|
||||
<< " is_contiguous:"
|
||||
<< is_contiguous<Type>::value
|
||||
<< ", is base:"
|
||||
<< UPstream_base_dataType<Type>::value
|
||||
<< ", is cmpt:"
|
||||
<< UPstream_dataType<Type>::value << nl;
|
||||
|
||||
Info<< "is base:"
|
||||
<< UPstream_base_dataType<Type>::value
|
||||
<< " (type:" << int(UPstream_base_dataType<Type>::datatype_id)
|
||||
<< ") is alias:" << UPstream_alias_dataType<Type>::value
|
||||
<< " (type:" << int(UPstream_alias_dataType<Type>::datatype_id)
|
||||
<< ")" << nl;
|
||||
|
||||
<< is_contiguous<Type>::value;
|
||||
|
||||
if constexpr (UPstream_mpi_dataType<Type>::value)
|
||||
{
|
||||
int index = int(UPstream_base_dataType<Type>::datatype_id);
|
||||
Info<< "datatype: " << index;
|
||||
Info<< ", is_mpi=("
|
||||
<< int(UPstream_mpi_dataType<Type>::datatype_id) << ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << ", is_mpi=(null)";
|
||||
}
|
||||
if constexpr (UPstream_user_dataType<Type>::value)
|
||||
{
|
||||
Info<< ", is_user=("
|
||||
<< int(UPstream_user_dataType<Type>::datatype_id) << ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << ", is_user=(null)";
|
||||
}
|
||||
if constexpr (UPstream_any_dataType<Type>::value)
|
||||
{
|
||||
Info<< ", is_any=("
|
||||
<< int(UPstream_any_dataType<Type>::datatype_id) << ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << ", is_any=(null)";
|
||||
}
|
||||
|
||||
if (index < dataType_names.size())
|
||||
{
|
||||
Info<< ' ' << dataType_names[index];
|
||||
}
|
||||
Info<< nl;
|
||||
// Any aliases?
|
||||
if constexpr
|
||||
(
|
||||
UPstream_alias_dataType<Type>::value
|
||||
&& !UPstream_mpi_dataType<Type>::value
|
||||
)
|
||||
{
|
||||
Info<< ", alias=("
|
||||
<< int(UPstream_alias_dataType<Type>::datatype_id) << ')';
|
||||
}
|
||||
|
||||
Info<< " base-type:" << int(UPstream_basic_dataType<Type>::datatype_id)
|
||||
<< " data-type:" << int(UPstream_dataType<Type>::datatype_id)
|
||||
<< nl;
|
||||
|
||||
if constexpr (UPstream_basic_dataType<Type>::value)
|
||||
{
|
||||
Info<< " base-type=";
|
||||
printDataTypeId(UPstream_basic_dataType<Type>::datatype_id);
|
||||
}
|
||||
else if constexpr (UPstream_dataType<Type>::value)
|
||||
{
|
||||
Info<< " data-type=";
|
||||
printDataTypeId(UPstream_dataType<Type>::datatype_id);
|
||||
}
|
||||
|
||||
{
|
||||
// Use element or component type (or byte-wise) for data type
|
||||
using base = typename UPstream_dataType<Type>::base;
|
||||
constexpr auto datatype = UPstream_dataType<Type>::datatype_id;
|
||||
|
||||
Info<< "datatype => ";
|
||||
printTypeName<base>();
|
||||
Info<< " (" << sizeof(Type)/sizeof(base) << " elems)" << nl
|
||||
<< "datatype: " << static_cast<int>(datatype) << nl;
|
||||
Info<< " : ";
|
||||
if constexpr (UseTypeName)
|
||||
{
|
||||
printTypeName<base, true>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< typeid(base).name() << " (" << sizeof(base) << " bytes)";
|
||||
}
|
||||
|
||||
Info<< " cmpt-type=";
|
||||
printDataTypeId(UPstream_dataType<Type>::datatype_id);
|
||||
Info<< " count=" << UPstream_dataType<Type>::size(1);
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,15 +321,44 @@ template<class BinaryOp>
|
||||
void printOpCodeTraits(BinaryOp bop, std::string_view name)
|
||||
{
|
||||
Info<< "op: " << name << ' ';
|
||||
if constexpr (UPstream_opType<BinaryOp>::value)
|
||||
|
||||
printOpCodeId(UPstream_opType<BinaryOp>::opcode_id);
|
||||
Info<< nl;
|
||||
}
|
||||
|
||||
|
||||
template<class DataType, class BinaryOp>
|
||||
void printOpCodeTraits(BinaryOp bop, std::string_view name)
|
||||
{
|
||||
Info<< "op: " << name << ' ';
|
||||
|
||||
printOpCodeId(UPstream_opType<BinaryOp>::opcode_id);
|
||||
|
||||
if constexpr (!std::is_void_v<DataType>)
|
||||
{
|
||||
Info<< "supported";
|
||||
if constexpr (UPstream_basic_dataType<DataType>::value)
|
||||
{
|
||||
Info<< " [supported type]";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " [disabled]";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "unknown";
|
||||
}
|
||||
Info<< ": " << int(UPstream_opType<BinaryOp>::opcode_id) << nl;
|
||||
Info<< nl;
|
||||
}
|
||||
|
||||
|
||||
template<class DataType, class BinaryOp>
|
||||
void print_data_opType(BinaryOp bop, std::string_view name)
|
||||
{
|
||||
Info<< "op: " << name << ' ';
|
||||
|
||||
printOpCodeId(UPstream_data_opType<BinaryOp, DataType>::opcode_id);
|
||||
|
||||
const bool ok = UPstream_data_opType<BinaryOp, DataType>::value;
|
||||
|
||||
Info<< " okay=" << ok << nl;
|
||||
}
|
||||
|
||||
|
||||
@ -210,6 +370,16 @@ int main()
|
||||
printPstreamTraits<bool>();
|
||||
printPstreamTraits<label>();
|
||||
|
||||
printPstreamTraits<char, false>("<char>");
|
||||
printPstreamTraits<signed char, false>("<signed char>");
|
||||
printPstreamTraits<unsigned char, false>("<unsigned char>");
|
||||
|
||||
printPstreamTraits<int8_t, false>("<int8_t>");
|
||||
printPstreamTraits<uint8_t, false>("<uint8_t>");
|
||||
|
||||
printPstreamTraits<int16_t, false>("<int16_t>");
|
||||
printPstreamTraits<uint16_t, false>("<uint16_t>");
|
||||
|
||||
printPstreamTraits<int>("<int>");
|
||||
printPstreamTraits<long>("<long>");
|
||||
printPstreamTraits<unsigned>("<unsigned>");
|
||||
@ -258,6 +428,35 @@ int main()
|
||||
printOpCodeTraits(bitAndOp<unsigned>{}, "bitAnd<unsigned>");
|
||||
printOpCodeTraits(bitOrOp<unsigned>{}, "bitOr<unsigned>");
|
||||
|
||||
printOpCodeTraits<vector>(sumOp<vector>{}, "sum");
|
||||
printOpCodeTraits(sumOp<scalarMinMax>{}, "sum");
|
||||
|
||||
printOpCodeTraits(std::plus<>{}, "sum");
|
||||
printOpCodeTraits<bool>(std::plus<>{}, "sum");
|
||||
printOpCodeTraits<vector>(std::plus<>{}, "sum");
|
||||
|
||||
|
||||
// Expect success
|
||||
Info<< nl << "expect success" << nl;
|
||||
print_data_opType<vector>(maxOp<scalar>(), "maxOp(scalar)");
|
||||
print_data_opType<unsigned>(bitOrOp<unsigned>(), "bitOrOp(unsigned)");
|
||||
print_data_opType<uint8_t>(bitOrOp<uint8_t>(), "bitOrOp(uint8_t)");
|
||||
print_data_opType<uint16_t>(bitOrOp<uint16_t>(), "bitOrOp(uint16_t)");
|
||||
|
||||
// Even allow signed integrals
|
||||
print_data_opType<int>(bitOrOp<int>(), "bitOrOp(int)");
|
||||
print_data_opType<int8_t>(bitOrOp<int8_t>(), "bitOrOp(int8_t)");
|
||||
|
||||
// Failure - supported op, unsupported data type.
|
||||
Info<< nl << "expect failure" << nl;
|
||||
print_data_opType<bool>(maxOp<scalar>(), "maxOp(scalar, bool)");
|
||||
print_data_opType<bool>(bitOrOp<unsigned>(), "bitOrOp(unsigned, bool)");
|
||||
|
||||
// False positives. Failure - supported op, unsupported data type.
|
||||
Info<< nl << "false positives" << nl;
|
||||
print_data_opType<void>(maxOp<bool>(), "maxOp(bool, void)");
|
||||
print_data_opType<float>(bitOrOp<unsigned>(), "bitOrOp(unsigned, float)");
|
||||
|
||||
Info<< nl << "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
3
applications/test/gather-scatter1/Make/files
Normal file
3
applications/test/gather-scatter1/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-gather-scatter1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-gather-scatter1
|
||||
2
applications/test/gather-scatter1/Make/options
Normal file
2
applications/test/gather-scatter1/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
282
applications/test/gather-scatter1/Test-gather-scatter1.cxx
Normal file
282
applications/test/gather-scatter1/Test-gather-scatter1.cxx
Normal file
@ -0,0 +1,282 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-gather-scatter1
|
||||
|
||||
Description
|
||||
Simple tests for gather/scatter
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "List.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "Pstream.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
//- Ostensibly the inverse of gatherList, but actually works like
|
||||
//- a broadcast that skips overwriting the local rank!
|
||||
template<class T>
|
||||
void real_scatterList
|
||||
(
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
[[maybe_unused]] const int tag = UPstream::msgType(),
|
||||
const int communicator = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
if (!UPstream::is_parallel(communicator))
|
||||
{
|
||||
// Nothing to do
|
||||
return;
|
||||
}
|
||||
else if constexpr (is_contiguous_v<T>)
|
||||
{
|
||||
// This part is a real in-place scatter:
|
||||
|
||||
// In-place scatter for contiguous types - one element per rank
|
||||
// - on master:
|
||||
// * send pointer is the full list
|
||||
// * recv pointer is first destination
|
||||
// - on rank:
|
||||
// * send pointer is irrelevant
|
||||
// * recv pointer is destination in the list
|
||||
//
|
||||
// So can simply use identical pointers for send/recv
|
||||
|
||||
auto* ptr = values.data() + UPstream::myProcNo(communicator);
|
||||
UPstream::mpiScatter(ptr, ptr, 1, communicator);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Communication order
|
||||
const auto& commOrder = UPstream::whichCommunication(communicator);
|
||||
|
||||
Pstream::scatterList_algorithm(commOrder, values, tag, communicator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- gatherList_algorithm, but with specific communication style
|
||||
template<class T>
|
||||
void gatherList_algo
|
||||
(
|
||||
const bool linear,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
[[maybe_unused]] const int tag = UPstream::msgType(),
|
||||
const int communicator = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
if (UPstream::is_parallel(communicator))
|
||||
{
|
||||
Pstream::gatherList_algorithm
|
||||
(
|
||||
UPstream::whichCommunication(communicator, linear),
|
||||
values,
|
||||
tag,
|
||||
communicator
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- scatterList_algorithm, but with specific communication style
|
||||
template<class T>
|
||||
void scatterList_algo
|
||||
(
|
||||
const bool linear,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
[[maybe_unused]] const int tag = UPstream::msgType(),
|
||||
const int communicator = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
if (UPstream::is_parallel(communicator))
|
||||
{
|
||||
Pstream::scatterList_algorithm
|
||||
(
|
||||
UPstream::whichCommunication(communicator, linear),
|
||||
values,
|
||||
tag,
|
||||
communicator
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Perform tests
|
||||
template<class ListType, class ResetCode>
|
||||
void doTest(ResetCode reset)
|
||||
{
|
||||
ListType values;
|
||||
|
||||
reset(values);
|
||||
|
||||
Pout<< nl << "before:" << flatOutput(values) << endl;
|
||||
Pstream::broadcastList(values);
|
||||
Pout<< "broadcast:" << flatOutput(values) << endl;
|
||||
|
||||
reset(values);
|
||||
|
||||
Pout<< nl << "before:" << flatOutput(values) << endl;
|
||||
Pstream::scatterList(values);
|
||||
Pout<< "scatter:" << flatOutput(values) << endl;
|
||||
|
||||
reset(values);
|
||||
|
||||
Pout<< "before:" << flatOutput(values) << endl;
|
||||
real_scatterList(values);
|
||||
Pout<< "inplace:" << flatOutput(values) << endl;
|
||||
|
||||
using control = std::pair<int, int>;
|
||||
|
||||
const char* algoType[2] = { "tree", "linear" };
|
||||
|
||||
for
|
||||
(
|
||||
auto [gather, scatter] :
|
||||
{
|
||||
control{0, 0},
|
||||
control{1, 1},
|
||||
control{0, 1},
|
||||
control{1, 0}
|
||||
}
|
||||
)
|
||||
{
|
||||
reset(values);
|
||||
|
||||
Pout<< nl << "before:" << flatOutput(values) << endl;
|
||||
|
||||
gatherList_algo(gather, values);
|
||||
Pout<< "gather[" << algoType[gather] << "]:"
|
||||
<< flatOutput(values) << endl;
|
||||
|
||||
scatterList_algo(scatter, values);
|
||||
Pout<< "scatter[" << algoType[scatter] << "]:"
|
||||
<< flatOutput(values) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noCheckProcessorDirectories();
|
||||
argList::addVerboseOption("increase UPstream::debug level");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const int optVerbose = args.verbose();
|
||||
|
||||
if (optVerbose)
|
||||
{
|
||||
UPstream::debug = optVerbose;
|
||||
}
|
||||
|
||||
Pout<< nl << "Test contiguous" << endl;
|
||||
{
|
||||
doTest<labelList>
|
||||
(
|
||||
[](auto& values){
|
||||
if (UPstream::master())
|
||||
{
|
||||
values = identity(UPstream::nProcs());
|
||||
}
|
||||
else
|
||||
{
|
||||
values.resize(UPstream::nProcs());
|
||||
values = -1;
|
||||
values[UPstream::myProcNo()] = 10 * UPstream::myProcNo();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Pout<< nl << "Test non-contiguous" << endl;
|
||||
{
|
||||
doTest<wordList>
|
||||
(
|
||||
[](auto& values) {
|
||||
values.resize(UPstream::nProcs());
|
||||
if (UPstream::master())
|
||||
{
|
||||
forAll(values, i)
|
||||
{
|
||||
values[i] = "proc" + Foam::name(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
values = "none";
|
||||
values[UPstream::myProcNo()] =
|
||||
"_" + Foam::name(UPstream::myProcNo());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Test dummy broadcast as well
|
||||
Pout<< nl << "Test broadcastList" << endl;
|
||||
{
|
||||
wordList list;
|
||||
|
||||
Pout<< nl << "before: " << flatOutput(list) << endl;
|
||||
|
||||
Pstream::broadcastList(list);
|
||||
Pout<< "-> " << flatOutput(list) << endl;
|
||||
}
|
||||
|
||||
// Test in-place reduce
|
||||
Pout<< nl << "Test in-place reduce" << endl;
|
||||
{
|
||||
FixedList<label, 6> list;
|
||||
list = UPstream::myProcNo();
|
||||
|
||||
Pout<< nl << "before: " << flatOutput(list) << endl;
|
||||
|
||||
UPstream::mpiReduce
|
||||
(
|
||||
list.data(),
|
||||
list.size(),
|
||||
UPstream::opCodes::op_sum,
|
||||
UPstream::worldComm
|
||||
);
|
||||
|
||||
Pout<< "-> " << flatOutput(list) << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -345,8 +345,8 @@ static void reportOffsets(const globalIndex& gi)
|
||||
|
||||
UPstream::broadcast
|
||||
(
|
||||
allOffsets.data_bytes(),
|
||||
allOffsets.size_bytes(),
|
||||
allOffsets.data(),
|
||||
allOffsets.size(),
|
||||
interNodeComm
|
||||
);
|
||||
}
|
||||
@ -508,7 +508,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool useLocalComms = UPstream::usingNodeComms();
|
||||
const bool useLocalComms = UPstream::usingNodeComms(UPstream::worldComm);
|
||||
bool useWindow = args.found("window");
|
||||
bool useBuiltin = args.found("builtin");
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-DiagonalMatrix.C
|
||||
Test-DiagonalMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-DiagonalMatrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-EigenMatrix.C
|
||||
Test-EigenMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-EigenMatrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-Matrix.C
|
||||
Test-Matrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-Matrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-QRMatrix.C
|
||||
Test-QRMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-QRMatrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-RectangularMatrix.C
|
||||
Test-RectangularMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-RectangularMatrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-SquareMatrix.C
|
||||
Test-SquareMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-SquareMatrix
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-SymmetricSquareMatrix.C
|
||||
Test-SymmetricSquareMatrix.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-SymmetricSquareMatrix
|
||||
|
||||
@ -115,6 +115,13 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
const auto& procs = UPstream::localNode_parentProcs();
|
||||
Perr<< "local processors: [" << procs.min()
|
||||
<< ".." << procs.max() << ']' << endl;
|
||||
}
|
||||
|
||||
// Generate the graph
|
||||
if (UPstream::master(UPstream::worldComm))
|
||||
{
|
||||
|
||||
3
applications/test/one-sided1/Make/files
Normal file
3
applications/test/one-sided1/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-one-sided1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-one-sided1
|
||||
2
applications/test/one-sided1/Make/options
Normal file
2
applications/test/one-sided1/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
354
applications/test/one-sided1/Test-one-sided1.cxx
Normal file
354
applications/test/one-sided1/Test-one-sided1.cxx
Normal file
@ -0,0 +1,354 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-one-sided1
|
||||
|
||||
Description
|
||||
Simple test of one-sided communication
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IPstream.H"
|
||||
#include "OPstream.H"
|
||||
#include "SubField.H"
|
||||
#include "vector.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class T>
|
||||
Ostream& printSpanInfo(Ostream& os, const UList<T>& span)
|
||||
{
|
||||
os << "addr=" << Foam::name(span.cdata())
|
||||
<< " size= " << span.size();
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noCheckProcessorDirectories();
|
||||
argList::addVerboseOption();
|
||||
argList::addBoolOption("no-shared", "disable shared memory tests");
|
||||
argList::addBoolOption("no-sleep", "disable sleep for async test");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool with_shared = !args.found("no-shared");
|
||||
const bool with_sleep = !args.found("no-sleep");
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< nl
|
||||
<< "nProcs = " << UPstream::nProcs()
|
||||
<< " with " << UPstream::nComms() << " predefined comm(s)" << nl;
|
||||
|
||||
if (!UPstream::parRun())
|
||||
{
|
||||
Info<< "###############" << nl
|
||||
<< "Not running in parallel. Stopping now" << nl
|
||||
<< "###############" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const auto myProci = UPstream::myProcNo();
|
||||
const auto numProc = UPstream::nProcs();
|
||||
|
||||
// Make some windows
|
||||
Field<label> buffer(10 + myProci);
|
||||
buffer = myProci;
|
||||
|
||||
Pout<< "input: " << flatOutput(buffer) << endl;
|
||||
|
||||
UPstream::Window win;
|
||||
win.create(buffer, UPstream::worldComm);
|
||||
|
||||
// Pass 1
|
||||
// - grab things from sub-ranks
|
||||
if (UPstream::master())
|
||||
{
|
||||
win.lock_all(true);
|
||||
|
||||
win.get
|
||||
(
|
||||
buffer.slice(4, 2),
|
||||
1, // target_rank
|
||||
2 // target_disp
|
||||
);
|
||||
|
||||
win.unlock_all();
|
||||
}
|
||||
|
||||
Pout<< "output: " << flatOutput(buffer) << endl;
|
||||
|
||||
// Pass 2:
|
||||
// accumulate into master
|
||||
if (UPstream::is_subrank())
|
||||
{
|
||||
win.lock(0);
|
||||
|
||||
win.put
|
||||
(
|
||||
UPstream::opCodes::op_sum,
|
||||
buffer.slice(2, 4),
|
||||
UPstream::masterNo(),
|
||||
2 // target_disp
|
||||
);
|
||||
|
||||
win.unlock(0);
|
||||
}
|
||||
|
||||
Pout<< "updated: " << flatOutput(buffer) << endl;
|
||||
|
||||
// Pass 3:
|
||||
// Update some values - something very asynchronous
|
||||
if (UPstream::is_subrank())
|
||||
{
|
||||
if (with_sleep)
|
||||
{
|
||||
if (UPstream::myProcNo() % 3)
|
||||
{
|
||||
Foam::sleep(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
Foam::sleep(1);
|
||||
}
|
||||
}
|
||||
buffer *= 10;
|
||||
forAll(buffer, i)
|
||||
{
|
||||
buffer[i] *= 1 + (i % 3);
|
||||
}
|
||||
}
|
||||
|
||||
// Needs a process sync, otherwise master fetches old values
|
||||
UPstream::barrier(UPstream::worldComm);
|
||||
|
||||
label lastValue(-1);
|
||||
|
||||
if (UPstream::master())
|
||||
{
|
||||
win.lock_all(true);
|
||||
|
||||
for (const auto proci : UPstream::subProcs())
|
||||
{
|
||||
win.fetch_and_op
|
||||
(
|
||||
UPstream::opCodes::op_sum,
|
||||
buffer[0],
|
||||
lastValue,
|
||||
proci,
|
||||
2 // target_disp
|
||||
);
|
||||
}
|
||||
|
||||
// Force changes to occur
|
||||
win.flush_all();
|
||||
win.unlock_all();
|
||||
}
|
||||
|
||||
|
||||
Pout<< "last-value : " << lastValue << nl
|
||||
<< "final : " << flatOutput(buffer) << endl;
|
||||
|
||||
labelList allUpdates;
|
||||
|
||||
if (UPstream::master())
|
||||
{
|
||||
allUpdates.resize(UPstream::nProcs(), -10);
|
||||
|
||||
win.lock_all(true);
|
||||
|
||||
for (const auto proci : UPstream::subProcs())
|
||||
{
|
||||
win.get_value
|
||||
(
|
||||
allUpdates[proci],
|
||||
proci,
|
||||
2 // target_disp
|
||||
);
|
||||
}
|
||||
|
||||
win.flush_all();
|
||||
win.unlock_all();
|
||||
}
|
||||
|
||||
Info<< "gets: " << flatOutput(allUpdates) << endl;
|
||||
|
||||
|
||||
// This should fail (runtime)
|
||||
#if 0
|
||||
if (UPstream::master())
|
||||
{
|
||||
labelPair value1(-1, -1);
|
||||
|
||||
win.lock_all(true);
|
||||
|
||||
for (const auto proci : UPstream::subProcs())
|
||||
{
|
||||
win.fetch_and_op
|
||||
(
|
||||
UPstream::opCodes::op_sum,
|
||||
value1,
|
||||
lastValue,
|
||||
proci,
|
||||
8 // target_disp
|
||||
);
|
||||
}
|
||||
|
||||
win.unlock_all();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Last thing before closing out
|
||||
// replace values. Not very efficient...
|
||||
|
||||
// Persistent data to move onto target:
|
||||
const label newValue(333);
|
||||
const label multiplier(-3);
|
||||
|
||||
if (UPstream::master())
|
||||
{
|
||||
win.lock_all(true);
|
||||
|
||||
for (const auto proci : UPstream::subProcs())
|
||||
{
|
||||
win.fetch_and_op
|
||||
(
|
||||
UPstream::opCodes::op_replace,
|
||||
newValue,
|
||||
lastValue,
|
||||
proci, // target_rank
|
||||
3 // target_disp
|
||||
);
|
||||
|
||||
win.put_value
|
||||
(
|
||||
UPstream::opCodes::op_prod,
|
||||
multiplier,
|
||||
proci, // target_rank
|
||||
5 // target_disp
|
||||
);
|
||||
}
|
||||
win.unlock_all();
|
||||
}
|
||||
|
||||
win.close(); // process collective
|
||||
|
||||
Pout<< "modified: " << flatOutput(buffer) << endl;
|
||||
|
||||
if (with_shared)
|
||||
{
|
||||
// Make some shared window
|
||||
UList<label> newBuffer;
|
||||
|
||||
{
|
||||
label localLen(0);
|
||||
|
||||
if
|
||||
(
|
||||
(myProci == 3)
|
||||
|| (myProci == numProc-2)
|
||||
)
|
||||
{
|
||||
localLen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLen = (10 + UPstream::myProcNo());
|
||||
}
|
||||
|
||||
// Just to prove that we can shallow copy the view...
|
||||
newBuffer =
|
||||
win.allocate_shared<label>(localLen, UPstream::worldComm);
|
||||
}
|
||||
|
||||
newBuffer = UPstream::myProcNo();
|
||||
|
||||
Pout<< "Shared: " << flatOutput(newBuffer) << endl;
|
||||
|
||||
{
|
||||
UList<label> local = win.view<label>();
|
||||
Pout<< "local win: ";
|
||||
printSpanInfo(Pout, local) << endl;
|
||||
}
|
||||
|
||||
Pout<< "Query rank1" << endl;
|
||||
|
||||
{
|
||||
// UPtrList<UList<label>> totalList(UPstream::nProcs());
|
||||
//
|
||||
// totalList.set(0, &newBuffer);
|
||||
|
||||
const label* ptr0 = nullptr;
|
||||
|
||||
{
|
||||
UList<label> buf = win.view_shared<label>(0);
|
||||
ptr0 = buf.cdata();
|
||||
|
||||
Pout<< "addr 0 = " << Foam::name(ptr0)
|
||||
<< " diff = " << label(0)
|
||||
<< " + " << buf.size() << endl;
|
||||
}
|
||||
|
||||
// UList<label> other = win.global_view<label>();
|
||||
|
||||
for (const auto proci : UPstream::subProcs())
|
||||
{
|
||||
UList<label> other = win.view_shared<label>(proci);
|
||||
|
||||
const label* ptr = other.cdata();
|
||||
|
||||
Pout<< "addr " << proci << " = "
|
||||
<< Foam::name(ptr)
|
||||
<< " diff = " << label(ptr - ptr0)
|
||||
<< " + " << other.size() << endl;
|
||||
// totalList.set(proci, &other);
|
||||
}
|
||||
}
|
||||
|
||||
win.close();
|
||||
}
|
||||
|
||||
// Since close() is ignored on null window,
|
||||
// can call it an arbitrary number of times
|
||||
win.close();
|
||||
win.close();
|
||||
win.close();
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,2 +1,3 @@
|
||||
Test-pTraits.C
|
||||
Test-pTraits.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-pTraits
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-regex1.C
|
||||
Test-regex1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-regex1
|
||||
|
||||
@ -35,11 +35,8 @@ Description
|
||||
#include "Switch.H"
|
||||
|
||||
#include "stringOps.H"
|
||||
#include "SubStrings.H"
|
||||
#include "regExp.H"
|
||||
#include "regExpCxx.H"
|
||||
#ifndef _WIN32
|
||||
#include "regExpPosix.H"
|
||||
#endif
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -89,20 +86,6 @@ static Ostream& operator<<(Ostream& os, const regExpCxx::results_type& sm)
|
||||
}
|
||||
|
||||
|
||||
// Simple output of match groups
|
||||
#ifndef _WIN32
|
||||
static Ostream& operator<<(Ostream& os, const regExpPosix::results_type& sm)
|
||||
{
|
||||
for (std::smatch::size_type i = 1; i < sm.size(); ++i)
|
||||
{
|
||||
os << " " << sm.str(i);
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template<class RegexType>
|
||||
void generalTests()
|
||||
{
|
||||
@ -299,10 +282,6 @@ int main(int argc, char *argv[])
|
||||
argList::noFunctionObjects();
|
||||
argList::noParallel();
|
||||
|
||||
argList::addBoolOption("cxx", "Test C++11 regular expressions");
|
||||
#ifndef _WIN32
|
||||
argList::addBoolOption("posix", "Test POSIX regular expressions");
|
||||
#endif
|
||||
argList::addOption
|
||||
(
|
||||
"regex",
|
||||
@ -321,34 +300,16 @@ int main(int argc, char *argv[])
|
||||
#ifdef _GLIBCXX_RELEASE
|
||||
Info<< "_GLIBCXX_RELEASE = " << (_GLIBCXX_RELEASE) << nl;
|
||||
#endif
|
||||
|
||||
if constexpr (std::is_same_v<regExp, regExpCxx>)
|
||||
{
|
||||
Info<< "Foam::regExp uses C++11 regex" << nl;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
if constexpr (std::is_same_v<regExp, regExpPosix>)
|
||||
{
|
||||
Info<< "Foam::regExp uses POSIX regex" << nl;
|
||||
}
|
||||
#ifdef __clang_major__
|
||||
Info<< "__clang_major__ = " << (__clang_major__) << nl;
|
||||
#endif
|
||||
|
||||
Info<< "sizeof std::regex: " << sizeof(std::regex) << nl;
|
||||
Info<< "sizeof regex C++11: " << sizeof(regExpCxx) << nl;
|
||||
#ifndef _WIN32
|
||||
Info<< "sizeof regex POSIX: " << sizeof(regExpPosix) << nl;
|
||||
#endif
|
||||
Info<< "sizeof regExp: " << sizeof(Foam::regExp) << nl;
|
||||
Info<< "sizeof word: " << sizeof(Foam::word) << nl;
|
||||
Info<< "sizeof wordRe: " << sizeof(Foam::wordRe) << nl;
|
||||
Info<< "sizeof keyType: " << sizeof(Foam::keyType) << nl;
|
||||
|
||||
if (!args.count({"cxx", "posix"}))
|
||||
{
|
||||
args.setOption("cxx");
|
||||
Info<< "Assuming -cxx as default" << nl;
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
if (args.found("regex"))
|
||||
{
|
||||
std::string expr(args["regex"]);
|
||||
@ -359,31 +320,15 @@ int main(int argc, char *argv[])
|
||||
<< "quotemeta: "
|
||||
<< stringOps::quotemeta(expr, regExpCxx::meta()) << nl
|
||||
<< nl;
|
||||
|
||||
#ifndef _WIN32
|
||||
Info<< "(posix):" << nl
|
||||
<< "meta : " << Switch(regExpPosix::is_meta(expr)) << nl
|
||||
<< "quotemeta: "
|
||||
<< stringOps::quotemeta(expr, regExpPosix::meta()) << nl
|
||||
<< nl;
|
||||
#endif
|
||||
Info<< nl;
|
||||
}
|
||||
else if (args.size() < 2)
|
||||
{
|
||||
Info<< "No test files specified .. restrict to general tests" << nl;
|
||||
|
||||
if (args.found("cxx"))
|
||||
{
|
||||
generalTests<regExpCxx>();
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
if (args.found("posix"))
|
||||
{
|
||||
generalTests<regExpPosix>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
for (label argi = 1; argi < args.size(); ++argi)
|
||||
@ -394,17 +339,9 @@ int main(int argc, char *argv[])
|
||||
Info<< "Test expressions:" << tests << endl;
|
||||
IOobject::writeDivider(Info) << endl;
|
||||
|
||||
if (args.found("cxx"))
|
||||
{
|
||||
testExpressions<regExpCxx>(tests);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
if (args.found("posix"))
|
||||
{
|
||||
testExpressions<regExpPosix>(tests);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Info<< "\nDone" << nl << endl;
|
||||
@ -1,3 +1,3 @@
|
||||
Test-sigFpe.C
|
||||
Test-sigFpe.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-sigFpe
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-string.C
|
||||
Test-string.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-string
|
||||
|
||||
@ -89,7 +89,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
inputType in1("move-construct-from");
|
||||
|
||||
Info<<"move construct from " << in1.length() << nl;
|
||||
Info<<"move construct from " << in1.size() << nl;
|
||||
|
||||
outputType out1(std::move(in1));
|
||||
|
||||
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
|
||||
out1 = "some-text-rubbish";
|
||||
out1.resize(10);
|
||||
|
||||
Info<<"move assign from " << in1.length() << nl;
|
||||
Info<<"move assign from " << in1.size() << nl;
|
||||
|
||||
out1 = std::move(in1);
|
||||
|
||||
@ -329,7 +329,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
string s2(s.expand());
|
||||
|
||||
cout<< "output string with " << s2.length() << " characters\n";
|
||||
cout<< "output string with " << s2.size() << " characters\n";
|
||||
cout<< "ostream<< >" << s2 << "<\n";
|
||||
Info<< "Ostream<< >" << s2 << "<\n";
|
||||
Info<< "hash:" << hex << string::hasher()(s2) << dec << endl;
|
||||
@ -1,3 +1,3 @@
|
||||
Test-stringList.C
|
||||
Test-stringList.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-stringList
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-stringSplit.C
|
||||
Test-stringSplit.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-stringSplit
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,18 +43,19 @@ template<class StringType>
|
||||
void printSubStrings
|
||||
(
|
||||
const StringType& str,
|
||||
const SubStrings<StringType>& split
|
||||
const SubStrings& split
|
||||
)
|
||||
{
|
||||
Info<< "string {" << str.size() << " chars} = " << str << nl
|
||||
<< split.size() << " elements {" << split.length() << " chars}"
|
||||
<< nl;
|
||||
|
||||
unsigned i = 0;
|
||||
for (const auto s : split)
|
||||
for (unsigned i = 0; i < split.size(); ++i)
|
||||
{
|
||||
Info<< "[" << i++ << "] {" << s.length() << " chars} = "
|
||||
<< s.str() << nl;
|
||||
const auto& s = split[i];
|
||||
Info<< "[" << i << "] {" << s.length() << " chars} = "
|
||||
<< split.view(i) << " == " << s.str()
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-vector.C
|
||||
Test-vector.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-vector
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,10 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "vectorField.H"
|
||||
#include "boolVector.H"
|
||||
#include "labelVector.H"
|
||||
#include "IOstreams.H"
|
||||
#include "FixedList.H"
|
||||
#include "Random.H"
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
@ -125,6 +128,42 @@ void testNormalise(Field<Type>& fld)
|
||||
}
|
||||
|
||||
|
||||
// Transcribe vectorspace information into a FixedList
|
||||
template<class Type>
|
||||
void testTranscribe(Type& input)
|
||||
{
|
||||
if constexpr
|
||||
(
|
||||
is_vectorspace_v<Type>
|
||||
&& std::is_floating_point_v<typename pTraits_cmptType<Type>::type>
|
||||
)
|
||||
{
|
||||
constexpr auto nCmpts = pTraits_nComponents<Type>::value;
|
||||
using cmpt = typename pTraits_cmptType<Type>::type;
|
||||
|
||||
FixedList<cmpt, nCmpts+1> values;
|
||||
values.back() = 100; // some additional data
|
||||
|
||||
VectorSpaceOps<nCmpts>::copy_n(input.cdata(), values.data());
|
||||
|
||||
Info<< "Transcribed " << input << " => " << values << nl;
|
||||
|
||||
for (auto& val : values)
|
||||
{
|
||||
val *= -1;
|
||||
}
|
||||
|
||||
VectorSpaceOps<nCmpts>::copy_n(values.cdata(), input.data());
|
||||
Info<< " copied back (-1) as " << input
|
||||
<< " from " << values << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Did not transcribe " << input << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -240,6 +279,16 @@ int main(int argc, char *argv[])
|
||||
testNormalise(vfld2);
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Test transcribing components" << nl;
|
||||
{
|
||||
vector vec1(1.1, 2.2, 3.3);
|
||||
testTranscribe(vec1);
|
||||
|
||||
labelVector vec2(10, 20, 30);
|
||||
testTranscribe(vec2);
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << nl;
|
||||
|
||||
return 0;
|
||||
@ -1,3 +1,3 @@
|
||||
Test-vectorTools.C
|
||||
Test-vectorTools.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-vectorTools
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +49,7 @@ Description
|
||||
#include <cstdio>
|
||||
|
||||
#include "scalar.H"
|
||||
#include "StringStream.H"
|
||||
#include "SpanStream.H"
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
@ -57,25 +57,23 @@ Description
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellShape.H"
|
||||
#include "SLList.H"
|
||||
#include "SLPtrList.H"
|
||||
|
||||
// Flex may use register, which is deprecated and incompatible with C++17
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-register"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
SLList<point> slPoints;
|
||||
SLList<label> slPointMap;
|
||||
DynamicList<point> dynPoints;
|
||||
DynamicList<label> dynPointMap;
|
||||
label maxNodei = 0;
|
||||
|
||||
SLPtrList<labelList> slCellLabels;
|
||||
SLList<label> slCellMap;
|
||||
SLList<label> slCellType;
|
||||
DynamicList<labelList> dynCellLabels;
|
||||
DynamicList<label> dynCellMap;
|
||||
DynamicList<label> dynCellType;
|
||||
label maxCelli = 0;
|
||||
|
||||
PtrList<SLList<label>> slPatchCells;
|
||||
PtrList<SLList<label>> slPatchCellFaces;
|
||||
// Per patch index, the cell/face pairs
|
||||
PtrList<DynamicList<labelPair>> patchCellFaces;
|
||||
|
||||
// Cell types
|
||||
Map<word> cellTypes;
|
||||
@ -126,22 +124,18 @@ elementType ^{space}"TYPE"{cspace}
|
||||
|
||||
%%
|
||||
|
||||
%{
|
||||
labelList labels(8);
|
||||
%}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *\
|
||||
------ Start Lexing ------
|
||||
\* ------------------------------------------------------------------------- */
|
||||
|
||||
{node}{label}{cspace}{x}{cspace}{y}{cspace}{z}{space}\n {
|
||||
IStringStream nodeStream(YYText());
|
||||
ISpanStream is(YYText());
|
||||
char tag, c;
|
||||
label nodei;
|
||||
point node;
|
||||
nodeStream
|
||||
>> tag
|
||||
point& node = dynPoints.emplace_back();
|
||||
|
||||
is
|
||||
>> tag // skip 'N'
|
||||
>> c >> nodei
|
||||
>> c >> node.x()
|
||||
>> c >> node.y()
|
||||
@ -149,17 +143,18 @@ elementType ^{space}"TYPE"{cspace}
|
||||
|
||||
if (nodei > maxNodei) maxNodei = nodei;
|
||||
|
||||
slPointMap.append(nodei);
|
||||
slPoints.append(node);
|
||||
dynPointMap.push_back(nodei);
|
||||
}
|
||||
|
||||
|
||||
{element}{label}{cspace}{label}{cspace}{label}{cspace}{label}{cspace}{label}{cspace}{label}{cspace}{label}{cspace}{label}{cspace}{label}{space}\n {
|
||||
IStringStream elementStream(YYText());
|
||||
ISpanStream is(YYText());
|
||||
char tag, c;
|
||||
label celli;
|
||||
elementStream
|
||||
>> tag >> tag
|
||||
labelList& labels = dynCellLabels.emplace_back(8);
|
||||
|
||||
is
|
||||
>> tag >> tag // skip 'EN'
|
||||
>> c >> celli
|
||||
>> c >> labels[0]
|
||||
>> c >> labels[1]
|
||||
@ -172,66 +167,50 @@ elementType ^{space}"TYPE"{cspace}
|
||||
|
||||
if (celli > maxCelli) maxCelli = celli;
|
||||
|
||||
slCellMap.append(celli);
|
||||
slCellLabels.append(new labelList(labels));
|
||||
slCellType.append(currentTypei);
|
||||
dynCellMap.push_back(celli);
|
||||
dynCellType.push_back(currentTypei);
|
||||
}
|
||||
|
||||
|
||||
{bface}{label}{cspace}{label}{cspace}{identifier}{cspace}{integer}{cspace}{value}{space}\n {
|
||||
IStringStream bfaceStream(YYText());
|
||||
ISpanStream is(YYText());
|
||||
char tag, c;
|
||||
label elementi;
|
||||
label facei;
|
||||
label elementi, facei;
|
||||
scalar indexValue, unknown;
|
||||
bfaceStream
|
||||
>> tag >> tag >> tag
|
||||
|
||||
is
|
||||
>> tag >> tag >> tag // skip 'SFE'
|
||||
>> c >> elementi
|
||||
>> c >> facei
|
||||
>> c >> tag >> tag >> tag >> tag
|
||||
>> c >> unknown
|
||||
>> c >> indexValue;
|
||||
|
||||
label patchi = label(indexValue);
|
||||
const label patchi = label(indexValue);
|
||||
|
||||
if (patchi > slPatchCells.size())
|
||||
if (patchCellFaces.size() < patchi)
|
||||
{
|
||||
slPatchCells.setSize(patchi);
|
||||
label i = patchCellFaces.size();
|
||||
|
||||
forAll(slPatchCells, i)
|
||||
patchCellFaces.resize(patchi);
|
||||
|
||||
for (; i < patchi; ++i)
|
||||
{
|
||||
if (!slPatchCells.set(i))
|
||||
{
|
||||
slPatchCells.set(i, new SLList<label>);
|
||||
}
|
||||
patchCellFaces.try_emplace(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (patchi > slPatchCellFaces.size())
|
||||
{
|
||||
slPatchCellFaces.setSize(patchi);
|
||||
|
||||
forAll(slPatchCells, i)
|
||||
{
|
||||
if (!slPatchCellFaces.set(i))
|
||||
{
|
||||
slPatchCellFaces.set(i, new SLList<label>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slPatchCells[patchi-1].append(elementi);
|
||||
slPatchCellFaces[patchi-1].append(facei);
|
||||
patchCellFaces[patchi-1].emplace_back(elementi, facei);
|
||||
}
|
||||
|
||||
|
||||
{elementTypeName}{label}{cspace}{identifier}{space}\n {
|
||||
|
||||
IStringStream elementStream(YYText());
|
||||
ISpanStream is(YYText());
|
||||
char tag,c;
|
||||
label cellTypei;
|
||||
word cellTypeName;
|
||||
elementStream
|
||||
|
||||
is
|
||||
>> tag >> tag // skip 'ET'
|
||||
>> c >> cellTypei
|
||||
>> c >> cellTypeName;
|
||||
@ -244,10 +223,11 @@ elementType ^{space}"TYPE"{cspace}
|
||||
|
||||
|
||||
{elementType}{label}{space}\n {
|
||||
IStringStream elementStream(YYText());
|
||||
ISpanStream is(YYText());
|
||||
char tag,c;
|
||||
label cellTypei;
|
||||
elementStream
|
||||
|
||||
is
|
||||
>> tag >> tag >> tag >> tag // skip 'TYPE'
|
||||
>> c >> cellTypei;
|
||||
|
||||
@ -281,10 +261,8 @@ label findFace(const polyMesh& mesh, const face& f)
|
||||
{
|
||||
const labelList& pFaces = mesh.pointFaces()[f[0]];
|
||||
|
||||
forAll(pFaces, i)
|
||||
for (const label facei : pFaces)
|
||||
{
|
||||
label facei = pFaces[i];
|
||||
|
||||
if (mesh.faces()[facei] == f)
|
||||
{
|
||||
return facei;
|
||||
@ -323,7 +301,8 @@ int main(int argc, char *argv[])
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 1);
|
||||
// Actually uses default=0 to skip unnecessary scaling by factor 1.
|
||||
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 0);
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
@ -344,32 +323,32 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Creating points" << endl;
|
||||
|
||||
pointField points(slPoints.size());
|
||||
pointField points(std::move(dynPoints));
|
||||
|
||||
label i = 0;
|
||||
for (const point& pt : slPoints)
|
||||
// Scale points by the given scale factor
|
||||
if (scaleFactor > 0)
|
||||
{
|
||||
// Scale points for the given scale factor
|
||||
points[i++] = scaleFactor * pt;
|
||||
points *= scaleFactor;
|
||||
}
|
||||
|
||||
|
||||
labelList pointMap(maxNodei+1);
|
||||
|
||||
i = 0;
|
||||
for (const label pointi : slPointMap)
|
||||
{
|
||||
pointMap[pointi] = i++;
|
||||
label i = 0;
|
||||
for (const label pointi : dynPointMap)
|
||||
{
|
||||
pointMap[pointi] = i++;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Creating cells" << endl;
|
||||
|
||||
labelList cellMap(maxCelli+1);
|
||||
|
||||
i = 0;
|
||||
for (const label celli : slCellMap)
|
||||
{
|
||||
cellMap[celli] = i++;
|
||||
label i = 0;
|
||||
for (const label celli : dynCellMap)
|
||||
{
|
||||
cellMap[celli] = i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -378,15 +357,15 @@ int main(int argc, char *argv[])
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelList labelsHex(8);
|
||||
labelList labelsPrism(6);
|
||||
labelList labelsPyramid(5);
|
||||
labelList labelsTet(4);
|
||||
FixedList<label, 8> labelsHex;
|
||||
FixedList<label, 6> labelsPrism;
|
||||
FixedList<label, 5> labelsPyramid;
|
||||
FixedList<label, 4> labelsTet;
|
||||
|
||||
cellShapeList cellShapes(slCellLabels.size());
|
||||
cellShapeList cellShapes(dynCellLabels.size());
|
||||
label nCells = 0;
|
||||
|
||||
for (const labelList& labels : slCellLabels)
|
||||
for (const labelList& labels : dynCellLabels)
|
||||
{
|
||||
if // Tetrahedron
|
||||
(
|
||||
@ -490,37 +469,29 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Creating boundary patches" << endl;
|
||||
|
||||
faceListList boundary(slPatchCells.size());
|
||||
wordList patchNames(slPatchCells.size());
|
||||
faceListList boundary(patchCellFaces.size());
|
||||
wordList patchNames(patchCellFaces.size());
|
||||
|
||||
forAll(slPatchCells, patchi)
|
||||
forAll(patchCellFaces, patchi)
|
||||
{
|
||||
SLList<face> patchFaces;
|
||||
DynamicList<face> patchFaces;
|
||||
|
||||
auto cellIter = slPatchCells[patchi].cbegin();
|
||||
auto faceIter = slPatchCellFaces[patchi].cbegin();
|
||||
patchFaces.reserve(patchCellFaces[patchi].size());
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
cellIter.good() && faceIter.good();
|
||||
++cellIter, ++faceIter
|
||||
)
|
||||
for (const auto& tup : patchCellFaces[patchi])
|
||||
{
|
||||
const cellShape& shape = cellShapes[cellMap[cellIter()]];
|
||||
const label celli = tup.first();
|
||||
const label facei = tup.second();
|
||||
|
||||
patchFaces.append
|
||||
const cellShape& shape = cellShapes[cellMap[celli]];
|
||||
|
||||
patchFaces.push_back
|
||||
(
|
||||
shape.faces()
|
||||
[
|
||||
faceIndex
|
||||
[shape.nFaces()]
|
||||
[faceIter()-1]
|
||||
]
|
||||
shape.faces()[faceIndex[shape.nFaces()][facei-1]]
|
||||
);
|
||||
}
|
||||
|
||||
boundary[patchi] = patchFaces;
|
||||
boundary[patchi] = std::move(patchFaces);
|
||||
patchNames[patchi] = polyPatch::defaultName(patchi + 1);
|
||||
}
|
||||
|
||||
@ -543,8 +514,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Now split the boundary faces into external and internal faces. All
|
||||
// faces go into faceZones and external faces go into patches.
|
||||
List<faceList> patchFaces(slPatchCells.size());
|
||||
labelList patchNFaces(slPatchCells.size(), Zero);
|
||||
List<faceList> patchFaces(patchCellFaces.size());
|
||||
labelList patchNFaces(patchCellFaces.size(), Zero);
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
const faceList& bFaces = boundary[patchi];
|
||||
@ -644,7 +615,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Creating faceZone " << patchNames[patchi]
|
||||
<< " with " << bFaceLabels.size() << " faces" << endl;
|
||||
|
||||
fz.append
|
||||
fz.push_back
|
||||
(
|
||||
new faceZone
|
||||
(
|
||||
@ -660,29 +631,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// CellZones
|
||||
labelList types = cellTypes.sortedToc();
|
||||
|
||||
forAll(types, typei)
|
||||
for (const label cellType : cellTypes.sortedToc())
|
||||
{
|
||||
const label cellType = types[typei];
|
||||
|
||||
// Pick up cells in zone
|
||||
DynamicList<label> addr;
|
||||
|
||||
auto cellMapIter = slCellMap.cbegin();
|
||||
auto typeIter = slCellType.cbegin();
|
||||
auto cellMapIter = dynCellMap.cbegin();
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
typeIter.good();
|
||||
++typeIter, ++cellMapIter
|
||||
)
|
||||
for (const auto& ctype : dynCellType)
|
||||
{
|
||||
if (typeIter() == cellType)
|
||||
if (ctype == cellType)
|
||||
{
|
||||
addr.append(cellMap[cellMapIter()]);
|
||||
addr.push_back(cellMap[*cellMapIter]);
|
||||
}
|
||||
++cellMapIter;
|
||||
}
|
||||
|
||||
Info<< "Creating cellZone " << cellTypes[cellType]
|
||||
@ -694,7 +656,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
cellTypes[cellType],
|
||||
addr,
|
||||
typei,
|
||||
cz.size(),
|
||||
pShapeMesh.cellZones()
|
||||
)
|
||||
);
|
||||
|
||||
@ -645,7 +645,7 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
|
||||
|
||||
// Parse all
|
||||
SubStrings<string> split;
|
||||
SubStrings split;
|
||||
|
||||
while (is.good())
|
||||
{
|
||||
|
||||
@ -181,7 +181,7 @@ forAll(cellShapes, celli)
|
||||
|
||||
label bcIDs[11] = {-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};
|
||||
|
||||
const label nBCs = 12;
|
||||
constexpr label nBCs = 12;
|
||||
|
||||
const word* kivaPatchTypes[nBCs] =
|
||||
{
|
||||
@ -232,7 +232,7 @@ const char* kivaPatchNames[nBCs] =
|
||||
};
|
||||
|
||||
|
||||
List<SLList<face>> pFaces[nBCs];
|
||||
List<DynamicList<face>> pFaces[nBCs];
|
||||
|
||||
face quadFace(4);
|
||||
face triFace(3);
|
||||
@ -337,23 +337,23 @@ if
|
||||
|
||||
minz += SMALL;
|
||||
|
||||
SLList<face> newLinerFaces;
|
||||
DynamicList<face> newLinerFaces;
|
||||
|
||||
for (const face& pf : pFaces[LINER][0])
|
||||
{
|
||||
scalar minfz = GREAT;
|
||||
forAll(pf, pfi)
|
||||
for (const label pointi : pf)
|
||||
{
|
||||
minfz = min(minfz, points[pf[pfi]].z());
|
||||
minfz = Foam::min(minfz, points[pointi].z());
|
||||
}
|
||||
|
||||
if (minfz > minz)
|
||||
{
|
||||
pFaces[CYLINDERHEAD][0].append(pf);
|
||||
pFaces[CYLINDERHEAD][0].push_back(pf);
|
||||
}
|
||||
else
|
||||
{
|
||||
newLinerFaces.append(pf);
|
||||
newLinerFaces.push_back(pf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,33 +361,33 @@ if
|
||||
{
|
||||
Info<< "Transferred " << pFaces[LINER][0].size() - newLinerFaces.size()
|
||||
<< " faces from liner region to cylinder head" << endl;
|
||||
pFaces[LINER][0] = newLinerFaces;
|
||||
pFaces[LINER][0] = std::move(newLinerFaces);
|
||||
}
|
||||
|
||||
SLList<face> newCylinderHeadFaces;
|
||||
DynamicList<face> newCylinderHeadFaces;
|
||||
|
||||
for (const face& pf : pFaces[CYLINDERHEAD][0])
|
||||
{
|
||||
scalar minfz = GREAT;
|
||||
forAll(pf, pfi)
|
||||
for (const label pointi : pf)
|
||||
{
|
||||
minfz = min(minfz, points[pf[pfi]].z());
|
||||
minfz = Foam::min(minfz, points[pointi].z());
|
||||
}
|
||||
|
||||
if (minfz < zHeadMin)
|
||||
{
|
||||
pFaces[LINER][0].append(pf);
|
||||
pFaces[LINER][0].push_back(pf);
|
||||
}
|
||||
else
|
||||
{
|
||||
newCylinderHeadFaces.append(pf);
|
||||
newCylinderHeadFaces.push_back(pf);
|
||||
}
|
||||
}
|
||||
|
||||
if (pFaces[CYLINDERHEAD][0].size() != newCylinderHeadFaces.size())
|
||||
{
|
||||
Info<< "Transferred faces from cylinder-head region to linder" << endl;
|
||||
pFaces[CYLINDERHEAD][0] = newCylinderHeadFaces;
|
||||
pFaces[CYLINDERHEAD][0] = std::move(newCylinderHeadFaces);
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,9 +396,9 @@ if
|
||||
label nPatches = 0;
|
||||
for (int bci=0; bci<nBCs; bci++)
|
||||
{
|
||||
forAll(pFaces[bci], rgi)
|
||||
for (const auto& faces : pFaces[bci])
|
||||
{
|
||||
if (pFaces[bci][rgi].size())
|
||||
if (faces.size())
|
||||
{
|
||||
nPatches++;
|
||||
}
|
||||
@ -415,31 +415,34 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
|
||||
|
||||
const scalar tanTheta = Foam::tan(degToRad(2.5));
|
||||
|
||||
auto iterf = pFaces[WEDGE][0].begin();
|
||||
auto iterb = pFaces[WEDGE][1].begin();
|
||||
auto iterf = pFaces[WEDGE][0].cbegin();
|
||||
auto iterb = pFaces[WEDGE][1].cbegin();
|
||||
|
||||
const auto end_iterf = pFaces[WEDGE][0].cend();
|
||||
const auto end_iterb = pFaces[WEDGE][1].cend();
|
||||
|
||||
for
|
||||
(
|
||||
;
|
||||
iterf.good() && iterb.good();
|
||||
(iterf != end_iterf) && (iterb != end_iterb);
|
||||
++iterf, ++iterb
|
||||
)
|
||||
{
|
||||
const auto& facef = *iterf;
|
||||
const auto& faceb = *iterb;
|
||||
|
||||
for (direction d=0; d<4; d++)
|
||||
{
|
||||
points[iterf()[d]].y() = -tanTheta*points[iterf()[d]].x();
|
||||
points[iterb()[d]].y() = tanTheta*points[iterb()[d]].x();
|
||||
points[facef[d]].y() = -tanTheta*points[facef[d]].x();
|
||||
points[faceb[d]].y() = tanTheta*points[faceb[d]].x();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pFaces[CYCLIC].setSize(1);
|
||||
pFaces[CYCLIC].resize(1);
|
||||
pFaces[CYCLIC][0] = pFaces[WEDGE][0];
|
||||
for (const face& pf : pFaces[WEDGE][1])
|
||||
{
|
||||
pFaces[CYCLIC][0].append(pf);
|
||||
}
|
||||
pFaces[CYCLIC][0].push_back(pFaces[WEDGE][1]);
|
||||
|
||||
pFaces[WEDGE].clear();
|
||||
nPatches--;
|
||||
|
||||
@ -661,8 +661,8 @@ void countExtrudePatches
|
||||
}
|
||||
// Synchronise decision. Actual numbers are not important, just make
|
||||
// sure that they're > 0 on all processors.
|
||||
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
|
||||
Pstream::listReduce(zoneSidePatch, sumOp<label>());
|
||||
Pstream::listReduce(zoneZonePatch, sumOp<label>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ MarchingCubes = fastdualoctree_sgp
|
||||
include $(GENERAL_RULES)/cgal
|
||||
|
||||
EXE_INC = \
|
||||
$(c++LESSWARN) \
|
||||
-DUNIX \
|
||||
/* -IMarchingCubes */ \
|
||||
-I$(FASTDUALOCTREE_SRC_PATH) \
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,7 +37,7 @@ Description
|
||||
|
||||
#include "argList.H"
|
||||
#include "OFstream.H"
|
||||
#include "StringStream.H"
|
||||
#include "stringOps.H"
|
||||
#include "point.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
@ -58,58 +58,49 @@ string getLine(std::ifstream& is)
|
||||
}
|
||||
|
||||
|
||||
// Read space-separated vertices (with optional '/' arguments)
|
||||
labelList parseVertices(const string& line)
|
||||
// Token list with one of the following:
|
||||
// f v1 v2 v3 ...
|
||||
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||
// l v1 v2 v3 ...
|
||||
// l v1/vt1 v2/vt2 v3/vt3 ...
|
||||
static label readObjVertices
|
||||
(
|
||||
const SubStrings& tokens,
|
||||
DynamicList<label>& verts
|
||||
)
|
||||
{
|
||||
DynamicList<label> verts;
|
||||
verts.clear();
|
||||
|
||||
// Assume 'l' is followed by space.
|
||||
string::size_type endNum = 1;
|
||||
|
||||
do
|
||||
bool first = true;
|
||||
for (const auto& tok : tokens)
|
||||
{
|
||||
string::size_type startNum = line.find_first_not_of(' ', endNum);
|
||||
|
||||
if (startNum == string::npos)
|
||||
if (first)
|
||||
{
|
||||
break;
|
||||
// skip initial "f" or "l"
|
||||
first = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
endNum = line.find(' ', startNum);
|
||||
std::string vrtSpec(tok.str());
|
||||
|
||||
string vertexSpec;
|
||||
if (endNum != string::npos)
|
||||
if
|
||||
(
|
||||
const auto slash = vrtSpec.find('/');
|
||||
slash != std::string::npos
|
||||
)
|
||||
{
|
||||
vertexSpec = line.substr(startNum, endNum-startNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
vertexSpec = line.substr(startNum, line.size() - startNum);
|
||||
vrtSpec.erase(slash);
|
||||
}
|
||||
|
||||
string::size_type slashPos = vertexSpec.find('/');
|
||||
label vertId = readLabel(vrtSpec);
|
||||
|
||||
label vertI = 0;
|
||||
if (slashPos != string::npos)
|
||||
{
|
||||
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
||||
|
||||
intStream >> vertI;
|
||||
}
|
||||
else
|
||||
{
|
||||
IStringStream intStream(vertexSpec);
|
||||
|
||||
intStream >> vertI;
|
||||
}
|
||||
verts.append(vertI - 1);
|
||||
verts.push_back(vertId - 1);
|
||||
}
|
||||
while (true);
|
||||
|
||||
return verts.shrink();
|
||||
return verts.size();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -142,6 +133,8 @@ int main(int argc, char *argv[])
|
||||
DynamicList<labelList> polyLines;
|
||||
DynamicList<labelList> polygons;
|
||||
|
||||
DynamicList<label> dynVerts;
|
||||
|
||||
bool hasWarned = false;
|
||||
|
||||
label lineNo = 0;
|
||||
@ -152,33 +145,58 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (line.empty()) continue;
|
||||
|
||||
// Read first word
|
||||
IStringStream lineStream(line);
|
||||
word cmd(lineStream);
|
||||
const auto tokens = stringOps::splitSpace(line);
|
||||
|
||||
// Require command and some arguments
|
||||
if (tokens.size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const word cmd = word::validate(tokens[0]);
|
||||
|
||||
if (cmd == "v")
|
||||
{
|
||||
scalar x, y, z;
|
||||
// Vertex
|
||||
// v x y z
|
||||
|
||||
lineStream >> x >> y >> z;
|
||||
|
||||
points.append(point(x, y, z));
|
||||
points.emplace_back
|
||||
(
|
||||
readScalar(tokens[1]),
|
||||
readScalar(tokens[2]),
|
||||
readScalar(tokens[3])
|
||||
);
|
||||
}
|
||||
else if (cmd == "vn")
|
||||
{
|
||||
scalar x, y, z;
|
||||
// Vertex normals
|
||||
// vn x y z
|
||||
|
||||
lineStream >> x >> y >> z;
|
||||
|
||||
pointNormals.append(vector(x, y, z));
|
||||
pointNormals.emplace_back
|
||||
(
|
||||
readScalar(tokens[1]),
|
||||
readScalar(tokens[2]),
|
||||
readScalar(tokens[3])
|
||||
);
|
||||
}
|
||||
else if (cmd == "l")
|
||||
{
|
||||
polyLines.append(parseVertices(line));
|
||||
// Line
|
||||
// l v1 v2 v3 ...
|
||||
// OR
|
||||
// l v1/vt1 v2/vt2 v3/vt3 ...
|
||||
|
||||
readObjVertices(tokens, dynVerts);
|
||||
polyLines.emplace_back() = dynVerts;
|
||||
}
|
||||
else if (cmd == "f")
|
||||
{
|
||||
polygons.append(parseVertices(line));
|
||||
// f v1 v2 v3 ...
|
||||
// OR
|
||||
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||
|
||||
readObjVertices(tokens, dynVerts);
|
||||
polygons.emplace_back() = dynVerts;
|
||||
}
|
||||
else if (cmd != "")
|
||||
{
|
||||
@ -188,7 +206,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
WarningInFunction
|
||||
<< "Unrecognized OBJ command " << cmd << nl
|
||||
<< "In line " << lineStream.str()
|
||||
<< "In line " << line
|
||||
<< " at linenumber " << lineNo << nl
|
||||
<< "Only recognized commands are 'v' and 'l'.\n"
|
||||
<< "If this is a surface command use surfaceConvert instead"
|
||||
@ -230,46 +248,42 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
label nItems = 0;
|
||||
forAll(polyLines, polyI)
|
||||
for (const labelList& line : polyLines)
|
||||
{
|
||||
nItems += polyLines[polyI].size() + 1;
|
||||
nItems += line.size() + 1;
|
||||
}
|
||||
|
||||
outFile
|
||||
<< "LINES " << polyLines.size() << ' ' << nItems << nl;
|
||||
|
||||
forAll(polyLines, polyI)
|
||||
for (const labelList& line : polyLines)
|
||||
{
|
||||
const labelList& line = polyLines[polyI];
|
||||
|
||||
outFile << line.size();
|
||||
|
||||
forAll(line, i)
|
||||
for (const label vrt : line)
|
||||
{
|
||||
outFile << ' ' << line[i];
|
||||
outFile << ' ' << vrt;
|
||||
}
|
||||
outFile << nl;
|
||||
}
|
||||
|
||||
|
||||
nItems = 0;
|
||||
forAll(polygons, polyI)
|
||||
for (const labelList& line : polygons)
|
||||
{
|
||||
nItems += polygons[polyI].size() + 1;
|
||||
nItems += line.size() + 1;
|
||||
}
|
||||
|
||||
outFile
|
||||
<< "POLYGONS " << polygons.size() << ' ' << nItems << nl;
|
||||
|
||||
forAll(polygons, polyI)
|
||||
for (const labelList& line : polygons)
|
||||
{
|
||||
const labelList& line = polygons[polyI];
|
||||
|
||||
outFile << line.size();
|
||||
|
||||
forAll(line, i)
|
||||
for (const label vrt : line)
|
||||
{
|
||||
outFile << ' ' << line[i];
|
||||
outFile << ' ' << vrt;
|
||||
}
|
||||
outFile << nl;
|
||||
}
|
||||
|
||||
@ -1081,7 +1081,7 @@ label findCorrespondingRegion
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
|
||||
Pstream::listReduce(cellsInZone, sumOp<label>());
|
||||
|
||||
// Pick region with largest overlap of zoneI
|
||||
label regionI = findMax(cellsInZone);
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
addr2line.C
|
||||
addr2line.cxx
|
||||
|
||||
EXE = $(FOAM_APPBIN)/addr2line
|
||||
|
||||
@ -1,2 +1,6 @@
|
||||
/* Disable normal project defaults */
|
||||
PROJECT_INC =
|
||||
PROJECT_LIBS =
|
||||
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 Alexey Matveichev
|
||||
Copyright (C) 2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,12 +34,11 @@ Description
|
||||
|
||||
#include <getopt.h>
|
||||
#include <cstdlib>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include "regExp.H"
|
||||
#include "SubStrings.H"
|
||||
|
||||
static void usage();
|
||||
static void version();
|
||||
@ -53,7 +53,6 @@ int main(int argc, char *argv[])
|
||||
int optHelp = 0, optFunctions = 0, optVersion = 0;
|
||||
int ch;
|
||||
std::string filename = "a.out";
|
||||
std::vector<std::string> addresses;
|
||||
|
||||
static struct option opts[] =
|
||||
{
|
||||
@ -100,15 +99,9 @@ int main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
while (argc > 0)
|
||||
{
|
||||
addresses.push_back(std::string(*argv));
|
||||
++argv;
|
||||
--argc;
|
||||
}
|
||||
|
||||
for (const auto& addr : addresses)
|
||||
for (std::string addr; argc > 0; --argc, ++argv)
|
||||
{
|
||||
addr.assign(*argv);
|
||||
std::cout<< '\n' << getLine(filename, addr).c_str() << '\n';
|
||||
}
|
||||
|
||||
@ -190,10 +183,10 @@ std::string getLine(const std::string& filename, const std::string& addr)
|
||||
);
|
||||
|
||||
|
||||
Foam::regExp re(".+LineEntry: .+: (.+):([0-9]+):[0-9]+");
|
||||
static std::regex re(".+LineEntry: .+: (.+):([0-9]+):[0-9]+");
|
||||
std::smatch groups;
|
||||
|
||||
Foam::regExp::results_type groups;
|
||||
if (!re.match(line, groups))
|
||||
if (!std::regex_match(line, groups, re))
|
||||
{
|
||||
line = "??:0";
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -140,6 +140,38 @@ using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Read dictionary from IFstream, setting the stream to ascii/binary mode
|
||||
//- depending on the 'FoamFile' header content
|
||||
dictionary readDictionary(Istream& is)
|
||||
{
|
||||
auto format = is.format();
|
||||
|
||||
// If the file starts with 'FoamFile { ... }'
|
||||
token tok;
|
||||
if
|
||||
(
|
||||
(tok.read(is) && tok.isWord("FoamFile"))
|
||||
&& (tok.read(is) && tok.isPunctuation(token::BEGIN_BLOCK))
|
||||
)
|
||||
{
|
||||
is.putBack(tok); // Put back '{'
|
||||
|
||||
// FoamFile sub-dictionary content
|
||||
dictionary header(is);
|
||||
|
||||
// Get "format" if present
|
||||
format = IOstreamOption::formatEnum("format", header, format);
|
||||
}
|
||||
|
||||
// Start again. Probably does not work well with IPstream though
|
||||
is.rewind();
|
||||
is.format(format);
|
||||
|
||||
// Read, preserving headers
|
||||
return dictionary(is, true);
|
||||
}
|
||||
|
||||
|
||||
//- Convert very old ':' scope syntax to less old '.' scope syntax,
|
||||
// but leave anything with '/' delimiters untouched
|
||||
bool upgradeScope(word& entryName)
|
||||
@ -266,6 +298,8 @@ void removeDict(dictionary& dict, const dictionary& dictToRemove)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
@ -273,7 +307,7 @@ int main(int argc, char *argv[])
|
||||
"Interrogate and manipulate dictionaries"
|
||||
);
|
||||
|
||||
argList::noBanner();
|
||||
argList::noBanner(); // Essential if redirecting stdout
|
||||
argList::noJobInfo();
|
||||
argList::addArgument("dict", "The dictionary file to process");
|
||||
argList::addBoolOption("keywords", "List keywords");
|
||||
@ -336,7 +370,7 @@ int main(int argc, char *argv[])
|
||||
"disableFunctionEntries",
|
||||
"Disable expansion of dictionary directives - #include, #codeStream etc"
|
||||
);
|
||||
profiling::disable(); // Disable profiling (and its output)
|
||||
profiling::disable(); // Disable profiling (and its output)
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
@ -369,7 +403,7 @@ int main(int argc, char *argv[])
|
||||
const auto dictFileName = args.get<fileName>(1);
|
||||
|
||||
auto dictFile = autoPtr<IFstream>::New(dictFileName);
|
||||
if (!dictFile().good())
|
||||
if (!dictFile || !dictFile().good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot open file " << dictFileName
|
||||
@ -379,8 +413,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
bool changed = false;
|
||||
|
||||
// Read but preserve headers
|
||||
dictionary dict(dictFile(), true);
|
||||
// Read, preserving headers
|
||||
//// dictionary dict(dictFile(), true);
|
||||
dictionary dict = readDictionary(dictFile());
|
||||
|
||||
// The extracted dictionary format
|
||||
const auto dictFormat = dictFile().format();
|
||||
|
||||
|
||||
if (listIncludes)
|
||||
{
|
||||
@ -414,8 +453,10 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError, 1);
|
||||
}
|
||||
|
||||
// Read but preserve headers
|
||||
diffDict.read(diffFile, true);
|
||||
// Read, preserving headers
|
||||
//// diffDict.read(diffFile, true);
|
||||
diffDict = readDictionary(diffFile);
|
||||
|
||||
optDiff = true;
|
||||
}
|
||||
else if (args.readIfPresent("diff-etc", diffFileName))
|
||||
@ -436,8 +477,9 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError, 1);
|
||||
}
|
||||
|
||||
// Read but preserve headers
|
||||
diffDict.read(diffFile, true);
|
||||
// Read, preserving headers
|
||||
//// diffDict.read(diffFile, true);
|
||||
diffDict = readDictionary(diffFile);
|
||||
optDiff = true;
|
||||
}
|
||||
}
|
||||
@ -592,10 +634,12 @@ int main(int argc, char *argv[])
|
||||
dict.write(Info, false);
|
||||
}
|
||||
|
||||
// Close the input file
|
||||
dictFile.reset();
|
||||
|
||||
if (changed)
|
||||
{
|
||||
dictFile.clear();
|
||||
OFstream os(dictFileName);
|
||||
OFstream os(dictFileName, dictFormat);
|
||||
IOobject::writeBanner(os);
|
||||
IOobject::writeDivider(os);
|
||||
dict.write(os, false);
|
||||
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
|
||||
maxIds.resize(maxNProcs, -1);
|
||||
|
||||
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
|
||||
Pstream::listReduce(maxIds, maxOp<label>());
|
||||
|
||||
// From ids to count
|
||||
const labelList numIds = maxIds + 1;
|
||||
|
||||
@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
|
||||
}
|
||||
|
||||
// Global sum
|
||||
Pstream::listCombineReduce(regionField, plusEqOp<T>());
|
||||
Pstream::listReduce(regionField, sumOp<T>());
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ void Foam::VF::raySearchEngine::createAgglomeration(const IOobject& io)
|
||||
Pstream::allGatherList(allSf_);
|
||||
Pstream::allGatherList(allAgg_);
|
||||
|
||||
Pstream::listCombineGather(patchAreas_, plusEqOp<scalar>());
|
||||
Pstream::listGather(patchAreas_, sumOp<scalar>());
|
||||
Pstream::broadcast(patchAreas_);
|
||||
|
||||
globalNumbering_ = globalIndex(nCoarseFace_);
|
||||
@ -262,8 +262,11 @@ void Foam::VF::raySearchEngine::createGeometry()
|
||||
Pstream::allGatherList(allCf_);
|
||||
Pstream::allGatherList(allSf_);
|
||||
|
||||
Pstream::listCombineGather(patchAreas_, plusEqOp<scalar>());
|
||||
Pstream::broadcast(patchAreas_);
|
||||
// Pstream::listCombineGather(patchAreas_, plusEqOp<scalar>());
|
||||
// Pstream::broadcast(patchAreas_);
|
||||
|
||||
// Basic type and op_sum, so can use listReduce (ie, mpiAllReduce)
|
||||
Pstream::listReduce(patchAreas_, sumOp<scalar>());
|
||||
|
||||
globalNumbering_ = globalIndex(nFace_);
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ bool setFaceFieldType
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineReduce(nChanged, plusEqOp<label>());
|
||||
Pstream::listReduce(nChanged, sumOp<label>());
|
||||
|
||||
auto& fieldBf = field.boundaryFieldRef();
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
include $(GENERAL_RULES)/cgal-header-only
|
||||
|
||||
EXE_INC = \
|
||||
$(c++LESSWARN) \
|
||||
$(COMP_FLAGS) \
|
||||
${CGAL_INC} \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
|
||||
@ -105,8 +105,13 @@ Description
|
||||
#include <vector>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1060011000)
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_triangle_primitive.h>
|
||||
#else
|
||||
#include <CGAL/AABB_traits_3.h>
|
||||
#include <CGAL/AABB_triangle_primitive_3.h>
|
||||
#endif
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
@ -116,8 +121,13 @@ typedef K::Triangle_3 Triangle;
|
||||
typedef K::Segment_3 Segment;
|
||||
|
||||
typedef std::vector<Triangle>::iterator Iterator;
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1060011000)
|
||||
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
||||
#else
|
||||
typedef CGAL::AABB_triangle_primitive_3<K, Iterator> Primitive;
|
||||
typedef CGAL::AABB_traits_3<K, Primitive> AABB_triangle_traits;
|
||||
#endif
|
||||
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
||||
|
||||
// Used boost::optional prior to CGAL-6.0
|
||||
|
||||
@ -6,6 +6,7 @@ EXE_NDEBUG = -DNDEBUG
|
||||
include $(GENERAL_RULES)/cgal
|
||||
|
||||
EXE_INC = \
|
||||
$(c++LESSWARN) \
|
||||
${ROUNDING_MATH} \
|
||||
${EXE_NDEBUG} \
|
||||
${CGAL_INC} \
|
||||
|
||||
@ -97,7 +97,11 @@ Description
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1060011000)
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#else
|
||||
#include <CGAL/AABB_traits_3.h>
|
||||
#endif
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include "CGALIndexedPolyhedron.H"
|
||||
#include "PolyhedronReader.H"
|
||||
@ -105,7 +109,11 @@ typedef CGAL::AABB_face_graph_triangle_primitive
|
||||
<
|
||||
Polyhedron, CGAL::Default, CGAL::Tag_false
|
||||
> Primitive;
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1060011000)
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
#else
|
||||
typedef CGAL::AABB_traits_3<K, Primitive> Traits;
|
||||
#endif
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
|
||||
// Used boost::optional prior to CGAL-6.0
|
||||
|
||||
@ -47,7 +47,7 @@ Description
|
||||
#include "janafThermo.H"
|
||||
#include "absoluteEnthalpy.H"
|
||||
|
||||
#include "SLPtrList.H"
|
||||
#include "PtrDynList.H"
|
||||
#include "IOdictionary.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -104,27 +104,12 @@ int main(int argc, char *argv[])
|
||||
thermo H2O(thermoData.subDict("H2O")); H2O *= H2O.W();
|
||||
thermo CO(thermoData.subDict("CO")); CO *= CO.W();
|
||||
|
||||
SLPtrList<thermo> EQreactions;
|
||||
PtrDynList<thermo> EQreactions(4);
|
||||
|
||||
EQreactions.append
|
||||
(
|
||||
new thermo(CO2 == CO + 0.5*O2)
|
||||
);
|
||||
|
||||
EQreactions.append
|
||||
(
|
||||
new thermo(O2 == 2*O)
|
||||
);
|
||||
|
||||
EQreactions.append
|
||||
(
|
||||
new thermo(H2O == H2 + 0.5*O2)
|
||||
);
|
||||
|
||||
EQreactions.append
|
||||
(
|
||||
new thermo(H2O == H + OH)
|
||||
);
|
||||
EQreactions.emplace_back((CO2 == CO + 0.5*O2));
|
||||
EQreactions.emplace_back((O2 == 2*O));
|
||||
EQreactions.emplace_back((H2O == H2 + 0.5*O2));
|
||||
EQreactions.emplace_back((H2O == H + OH));
|
||||
|
||||
|
||||
for (const thermo& react : EQreactions)
|
||||
|
||||
@ -43,6 +43,8 @@ options:
|
||||
-local Same as -spawn=1
|
||||
-remote Same as -spawn=2
|
||||
-clean Remove log and startup files
|
||||
-no-core Restrict core dump to 0 size
|
||||
-quick Valgrind with 'summary' (not 'full') and use -no-core
|
||||
-decompose-dict=<file> Specific decomposeParDict name
|
||||
-help Print the usage
|
||||
|
||||
@ -108,8 +110,9 @@ Linux)
|
||||
esac
|
||||
|
||||
unset appName appArgs nProcs
|
||||
unset method spawn optClean optValue
|
||||
unset method spawn optClean optValue opt_nocore
|
||||
optConfirm=true
|
||||
opt_leakcheck=full
|
||||
|
||||
decompDict="system/decomposeParDict"
|
||||
|
||||
@ -153,6 +156,15 @@ do
|
||||
: "${spawn:=local}"
|
||||
;;
|
||||
|
||||
-quick)
|
||||
opt_leakcheck="summary"
|
||||
opt_nocore=true
|
||||
;;
|
||||
|
||||
-no-core)
|
||||
opt_nocore=true
|
||||
;;
|
||||
|
||||
-valgr*)
|
||||
method="valgrind"
|
||||
unset optConfirm
|
||||
@ -338,12 +350,16 @@ fi
|
||||
|
||||
case "$sourceFoam" in
|
||||
*/bashrc)
|
||||
sourceFoam=". $sourceFoam $FOAM_SETTINGS"
|
||||
sourceFoam=". $sourceFoam $FOAM_SETTINGS || true"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "**sourceFoam: $sourceFoam" 1>&2
|
||||
|
||||
# remove old files
|
||||
rm -rf ./mpirun.files
|
||||
rm -rf ./mpirun.log
|
||||
|
||||
mkdir -p ./mpirun.files
|
||||
mkdir -p ./mpirun.log
|
||||
|
||||
@ -375,6 +391,12 @@ $sourceFoam
|
||||
cd "${PWD}" || exit
|
||||
COMMANDS
|
||||
|
||||
if [ "$opt_nocore" = true ]
|
||||
then
|
||||
echo "# no coredump" >> "$procCmdFile"
|
||||
echo "ulimit -c 0 2>/dev/null" >> "$procCmdFile"
|
||||
fi
|
||||
|
||||
# Add to the mpirun.schema
|
||||
case "$method" in
|
||||
(*xterm*) echo "${node}${xterm} -e ${procCmdFile}" >> "$schema_file" ;;
|
||||
@ -400,10 +422,16 @@ COMMANDS
|
||||
echo "read input"
|
||||
;;
|
||||
(valgrind | valgrind-log)
|
||||
echo "valgrind --leak-check=full --show-reachable=yes $exec $appArgs > $procLog 2>&1"
|
||||
echo "# valgrind does not work nicely with RMA (libfabric)"
|
||||
echo "export FI_PROVIDER=tcp"
|
||||
echo
|
||||
echo "valgrind --leak-check=$opt_leakcheck --show-reachable=yes $exec $appArgs > $procLog 2>&1"
|
||||
;;
|
||||
(valgrind-xterm)
|
||||
echo "valgrind --leak-check=full --show-reachable=yes $exec $appArgs 2>&1 | tee $procLog"
|
||||
echo "# valgrind does not work nicely with RMA (libfabric)"
|
||||
echo "export FI_PROVIDER=tcp"
|
||||
echo
|
||||
echo "valgrind --leak-check=$opt_leakcheck --show-reachable=yes $exec $appArgs 2>&1 | tee $procLog"
|
||||
echo "read input"
|
||||
;;
|
||||
(gperf)
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -103,6 +103,7 @@ Components versions (ThirdParty)
|
||||
-fftw VER specify 'fffw_version'
|
||||
-kahip VER specify 'KAHIP_VERSION'
|
||||
-metis VER specify 'METIS_VERSION'
|
||||
-petsc VER specify 'petsc_version'
|
||||
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
||||
|
||||
HELP_HEAD
|
||||
@ -118,8 +119,23 @@ Components specified by absolute path
|
||||
-fftw-path DIR Path for 'FFTW_ARCH_PATH' (overrides -fftw)
|
||||
-kahip-path DIR Path for 'KAHIP_ARCH_PATH' (overrides -kahip)
|
||||
-metis-path DIR Path for 'METIS_ARCH_PATH' (overrides -metis)
|
||||
-petsc-path DIR Path for 'PETSC_ARCH_PATH' (overrides -petsc)
|
||||
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
|
||||
|
||||
-gmp-path DIR Path for 'GMP_ARCH_PATH' (in cgal config)
|
||||
-mpfr-path DIR Path for 'MPFR_ARCH_PATH' (in cgal config)
|
||||
|
||||
Components specified by homebrew (treat like system locations)
|
||||
Sets version as system, path from brew --prefix
|
||||
-adios-brew, -adios2-brew, -boost-brew, -cgal-brew,
|
||||
-fftw-brew, -kahip-brew, -metis-brew, -scotch-brew
|
||||
|
||||
-with-homebrew Shortcut for selecting all the above
|
||||
|
||||
-gmp-brew Homebrew for 'GMP_ARCH_PATH' (in cgal config)
|
||||
-mpfr-brew Homebrew for 'MPFR_ARCH_PATH' (in cgal config)
|
||||
-petsc-brew Homebrew for petsc
|
||||
|
||||
Graphics
|
||||
-paraview VER specify 'ParaView_VERSION' (eg, 5.9.0 or system)
|
||||
-paraview-qt VER specify 'ParaView_QT' (eg, qt-system)
|
||||
@ -237,8 +253,8 @@ replace()
|
||||
|
||||
while [ "$#" -ge 2 ]
|
||||
do
|
||||
key=$1
|
||||
val=$2
|
||||
key="$1"
|
||||
val="$2"
|
||||
shift 2
|
||||
|
||||
_inlineSed \
|
||||
@ -262,18 +278,83 @@ replaceCsh()
|
||||
|
||||
while [ "$#" -ge 2 ]
|
||||
do
|
||||
key=$1
|
||||
val=$2
|
||||
key="$1"
|
||||
val="$2"
|
||||
shift 2
|
||||
|
||||
_inlineSed \
|
||||
"$file" \
|
||||
"setenv [ ]*$key [^ #]*" \
|
||||
"setenv [ ]*$key .*" \
|
||||
"setenv $key $val" \
|
||||
"Replaced $key by '$val'"
|
||||
done
|
||||
}
|
||||
|
||||
# Remove leading '#config#' marker from '#config export VAR=...'
|
||||
removeConfigMarker()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
local var cmd
|
||||
|
||||
while [ "$#" -ge 1 ]
|
||||
do
|
||||
var="$1"
|
||||
shift
|
||||
cmd='/^#config# *export [ ]*'"$var"'=/s@^#config# *@@'
|
||||
|
||||
if grep -q '^#config#' "$file" 2> /dev/null
|
||||
then
|
||||
sed -i -e "$cmd" "$file"
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Remove leading '#config#' marker from '#config setenv VAR ...'
|
||||
removeConfigMarkerCsh()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
local var cmd
|
||||
|
||||
while [ "$#" -ge 1 ]
|
||||
do
|
||||
var="$1"
|
||||
shift
|
||||
cmd='/^#config# *setenv [ ]*'"$var"'/s@^#config# *@@'
|
||||
|
||||
if grep -q '^#config#' "$file" 2> /dev/null
|
||||
then
|
||||
sed -i -e "$cmd" "$file"
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Remove leading '#config#' marker from '#config export VAR=...'
|
||||
removeEtcConfigMarker()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file="$(_foamEtc "$file")"
|
||||
removeConfigMarker "$file" "$@"
|
||||
}
|
||||
|
||||
# Remove leading '#config#' marker from '#config setenv VAR ...'
|
||||
removeEtcConfigMarkerCsh()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file="$(_foamEtc "$file")"
|
||||
removeConfigMarkerCsh "$file" "$@"
|
||||
}
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replace()
|
||||
replaceEtc()
|
||||
{
|
||||
@ -296,6 +377,30 @@ replaceEtcCsh()
|
||||
}
|
||||
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replace()
|
||||
replaceBrewEtc()
|
||||
{
|
||||
local file="$1"
|
||||
local var="$2"
|
||||
local pkg="$3"
|
||||
|
||||
file="$(_foamEtc "$file")"
|
||||
replace "$file" "$var" '"$(brew --prefix '"$pkg"' 2>/dev/null)"'
|
||||
}
|
||||
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replaceCsh()
|
||||
replaceBrewEtcCsh()
|
||||
{
|
||||
local file="$1"
|
||||
local var="$2"
|
||||
local pkg="$3"
|
||||
|
||||
file="$(_foamEtc "$file")"
|
||||
replaceCsh "$file" "$var" '`brew --prefix '"$pkg"'`'
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty argument
|
||||
# $1 option
|
||||
# $2 value
|
||||
@ -380,23 +485,46 @@ removeCshMagic()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset adjusted
|
||||
unset adjusted optHomebrew
|
||||
|
||||
# Pre-scan options
|
||||
case "$@" in (*-with-homebrew*) optHomebrew=true;; esac
|
||||
|
||||
# Preload with some options
|
||||
if [ "$optHomebrew" = true ]
|
||||
then
|
||||
set -- \
|
||||
-adios2-brew \
|
||||
-boost-brew \
|
||||
-cgal-brew \
|
||||
-fftw-brew \
|
||||
-kahip-brew \
|
||||
-metis-brew \
|
||||
-scotch-brew \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
unset brewName optValue
|
||||
|
||||
case "$1" in
|
||||
-help-c*) # Compat help
|
||||
printHelp -compat
|
||||
;;
|
||||
-help-f*) # Full help
|
||||
-help-f* | --help-f*) # Full help
|
||||
printHelp -full
|
||||
;;
|
||||
-h | -help*) # Short help
|
||||
-h | -help* | --help) # Short help
|
||||
printHelp
|
||||
;;
|
||||
'')
|
||||
# Discard empty arguments
|
||||
;;
|
||||
-with-homebrew)
|
||||
# Already handled (above)
|
||||
;;
|
||||
|
||||
-debug-list)
|
||||
# Undocumented (experimental)
|
||||
@ -437,8 +565,7 @@ CONFIG_CSH
|
||||
|
||||
-project-path=* | -project-path)
|
||||
# Replace WM_PROJECT_DIR=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -455,8 +582,7 @@ CONFIG_CSH
|
||||
|
||||
-version=* | -version | -foamVersion | --projectVersion)
|
||||
# Replace WM_PROJECT_VERSION=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -502,8 +628,7 @@ CONFIG_CSH
|
||||
|
||||
-clang=* | -clang)
|
||||
# Replace default_clang_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -517,8 +642,7 @@ CONFIG_CSH
|
||||
|
||||
-gcc=* | -gcc)
|
||||
# Replace default_gcc_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -532,8 +656,7 @@ CONFIG_CSH
|
||||
|
||||
-system-compiler | -system)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -551,8 +674,7 @@ CONFIG_CSH
|
||||
|
||||
-third-compiler | -third | -ThirdParty)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -597,8 +719,7 @@ CONFIG_CSH
|
||||
|
||||
-mpi=* | -mpi)
|
||||
# Explicitly set WM_MPLIB=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -661,8 +782,7 @@ CONFIG_CSH
|
||||
|
||||
-adios | -adios2)
|
||||
# Replace adios2_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -676,8 +796,7 @@ CONFIG_CSH
|
||||
|
||||
-adios-path | -adios2-path)
|
||||
# Replace ADIOS2_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -689,10 +808,22 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-adios-brew | -adios2-brew)
|
||||
brewName=adios2; optValue="${brewName}-system"
|
||||
|
||||
# Replace adios2_version=...
|
||||
replaceEtc config.sh/adios2 adios2_version "$optValue"
|
||||
replaceEtc config.csh/adios2 adios2_version "$optValue"
|
||||
|
||||
# Replace ADIOS2_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/adios2 ADIOS2_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-boost)
|
||||
# Replace boost_version=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
@ -707,24 +838,38 @@ CONFIG_CSH
|
||||
|
||||
-boost-path)
|
||||
# Replace BOOST_ARCH_PATH=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
|
||||
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
|
||||
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
|
||||
replaceEtcCsh config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
|
||||
adjusted=true
|
||||
else
|
||||
: "${adjusted:=empty}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-boost-brew)
|
||||
brewName=boost; optValue="${brewName}-system"
|
||||
|
||||
# (config is cgal or CGAL)
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
|
||||
# Replace boost_version=...
|
||||
replaceEtc config.sh/"$cfgName" boost_version "$optValue"
|
||||
replaceEtc config.csh/"$cfgName" boost_version "$optValue"
|
||||
|
||||
# Replace BOOST_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/"$cfgName" BOOST_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/"$cfgName" BOOST_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-cgal)
|
||||
# Replace cgal_version=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
@ -739,8 +884,7 @@ CONFIG_CSH
|
||||
|
||||
-cgal-path)
|
||||
# Replace CGAL_ARCH_PATH=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
@ -753,10 +897,96 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-cgal-brew)
|
||||
brewName=cgal; optValue="${brewName}-system"
|
||||
|
||||
# (config is cgal or CGAL)
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
|
||||
# Replace cgal_version=...
|
||||
replaceEtc config.sh/"$cfgName" cgal_version "$optValue"
|
||||
replaceEtc config.csh/"$cfgName" cgal_version "$optValue"
|
||||
|
||||
# Replace CGAL_ARCH_PATH=... (config is cgal or CGAL)
|
||||
replaceBrewEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-gmp-path)
|
||||
# Replace GMP_ARCH_PATH=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
# Remove leading '#config#' marker
|
||||
removeEtcConfigMarker config.sh/"$cfgName" GMP_ARCH_PATH
|
||||
removeEtcConfigMarkerCsh config.csh/"$cfgName" GMP_ARCH_PATH
|
||||
|
||||
replaceEtc config.sh/"$cfgName" GMP_ARCH_PATH "\"$optValue\""
|
||||
replaceEtcCsh config.csh/"$cfgName" GMP_ARCH_PATH "\"$optValue\""
|
||||
adjusted=true
|
||||
else
|
||||
: "${adjusted:=empty}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-gmp-brew)
|
||||
brewName=gmp; optValue="${brewName}-system"
|
||||
|
||||
# (config is cgal or CGAL)
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
|
||||
# Remove leading '#config#' marker
|
||||
removeEtcConfigMarker config.sh/"$cfgName" GMP_ARCH_PATH
|
||||
removeEtcConfigMarkerCsh config.csh/"$cfgName" GMP_ARCH_PATH
|
||||
|
||||
# Replace GMP_ARCH_PATH=... (config is cgal or CGAL)
|
||||
replaceBrewEtc config.sh/"$cfgName" GMP_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/"$cfgName" GMP_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-mpfr-path)
|
||||
# Replace MPFR_ARCH_PATH=... (config is cgal or CGAL)
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
# Remove leading '#config#' marker
|
||||
removeEtcConfigMarker config.sh/"$cfgName" MPFR_ARCH_PATH
|
||||
removeEtcConfigMarkerCsh config.csh/"$cfgName" MPFR_ARCH_PATH
|
||||
|
||||
replaceEtc config.sh/"$cfgName" MPFR_ARCH_PATH "\"$optValue\""
|
||||
replaceEtcCsh config.csh/"$cfgName" MPFR_ARCH_PATH "\"$optValue\""
|
||||
adjusted=true
|
||||
else
|
||||
: "${adjusted:=empty}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-mpfr-brew)
|
||||
brewName=mpfr; optValue="${brewName}-system"
|
||||
|
||||
# (config is cgal or CGAL)
|
||||
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
|
||||
|
||||
# Remove leading '#config#' marker
|
||||
removeEtcConfigMarker config.sh/"$cfgName" MPFR_ARCH_PATH
|
||||
removeEtcConfigMarkerCsh config.csh/"$cfgName" MPFR_ARCH_PATH
|
||||
|
||||
# Replace MPFR_ARCH_PATH=... (config is cgal or CGAL)
|
||||
replaceBrewEtc config.sh/"$cfgName" MPFR_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/"$cfgName" MPFR_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
|
||||
-fftw)
|
||||
# Replace fftw_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
# config.sh/fftw or config.sh/FFTW
|
||||
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
|
||||
@ -772,8 +1002,7 @@ CONFIG_CSH
|
||||
|
||||
-fftw-path)
|
||||
# Replace FFTW_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
# config.sh/fftw or config.sh/FFTW
|
||||
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
|
||||
@ -787,10 +1016,25 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-fftw-brew)
|
||||
brewName=fftw; optValue="${brewName}-system"
|
||||
|
||||
# (config is fftw or FFTW)
|
||||
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
|
||||
|
||||
# Replace fftw_version=...
|
||||
replaceEtc config.sh/"$cfgName" fftw_version "$optValue"
|
||||
replaceEtc config.csh/"$cfgName" fftw_version "$optValue"
|
||||
|
||||
# Replace FFTW_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/"$cfgName" FFTW_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-cmake)
|
||||
# Replace cmake_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -803,8 +1047,7 @@ CONFIG_CSH
|
||||
|
||||
-cmake-path)
|
||||
# Replace CMAKE_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -817,8 +1060,7 @@ CONFIG_CSH
|
||||
|
||||
-kahip)
|
||||
# Replace KAHIP_VERSION=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -831,8 +1073,7 @@ CONFIG_CSH
|
||||
|
||||
-kahip-path)
|
||||
# Replace KAHIP_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -843,10 +1084,20 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-kahip-brew)
|
||||
brewName=kahip; optValue="${brewName}-system"
|
||||
|
||||
# Replace KAHIP_VERSION=...
|
||||
replaceEtc config.sh/kahip KAHIP_VERSION "$optValue"
|
||||
|
||||
# Replace KAHIP_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/kahip KAHIP_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-metis)
|
||||
# Replace METIS_VERSION=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -859,8 +1110,7 @@ CONFIG_CSH
|
||||
|
||||
-metis-path)
|
||||
# Replace METIS_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -871,10 +1121,62 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-metis-brew)
|
||||
brewName=metis; optValue="${brewName}-system"
|
||||
|
||||
# Replace METIS_VERSION=...
|
||||
replaceEtc config.sh/metis METIS_VERSION "$optValue"
|
||||
adjusted=true
|
||||
|
||||
# Replace METIS_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/metis METIS_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-petsc)
|
||||
# Replace petsc_version=...
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
replaceEtc config.sh/petsc petsc_version "$optValue"
|
||||
replaceEtc config.csh/petsc petsc_version "$optValue"
|
||||
adjusted=true
|
||||
else
|
||||
: "${adjusted:=empty}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-petsc-path)
|
||||
# Replace PETSC_ARCH_PATH=...
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
replaceEtc config.sh/petsc PETSC_ARCH_PATH "\"$optValue\""
|
||||
replaceEtcCsh config.csh/petsc PETSC_ARCH_PATH "\"$optValue\""
|
||||
adjusted=true
|
||||
else
|
||||
: "${adjusted:=empty}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-petsc-brew)
|
||||
brewName=petsc; optValue="${brewName}-system"
|
||||
|
||||
# Replace petsc_version=...
|
||||
replaceEtc config.sh/petsc petsc_version "$optValue"
|
||||
replaceEtc config.csh/petsc petsc_version "$optValue"
|
||||
|
||||
# Replace PETSC_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/petsc PETSC_ARCH_PATH "$brewName"
|
||||
replaceBrewEtcCsh config.csh/petsc PETSC_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-scotch | -scotchVersion | --scotchVersion)
|
||||
# Replace SCOTCH_VERSION=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -887,8 +1189,7 @@ CONFIG_CSH
|
||||
|
||||
-scotch-path | -scotchArchPath | --scotchArchPath)
|
||||
# Replace SCOTCH_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -899,6 +1200,16 @@ CONFIG_CSH
|
||||
fi
|
||||
;;
|
||||
|
||||
-scotch-brew)
|
||||
brewName=scotch; optValue="${brewName}-system"
|
||||
|
||||
# Replace SCOTCH_VERSION=...
|
||||
replaceEtc config.sh/scotch SCOTCH_VERSION "$optValue"
|
||||
|
||||
# Replace SCOTCH_ARCH_PATH=...
|
||||
replaceBrewEtc config.sh/scotch SCOTCH_ARCH_PATH "$brewName"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
## Graphics ##
|
||||
|
||||
@ -923,8 +1234,7 @@ CONFIG_CSH
|
||||
|
||||
-paraview-qt)
|
||||
# Replace ParaView_QT=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -938,8 +1248,7 @@ CONFIG_CSH
|
||||
|
||||
-paraview-path | -paraviewInstall | --paraviewInstall)
|
||||
# Replace ParaView_DIR=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -953,8 +1262,7 @@ CONFIG_CSH
|
||||
|
||||
-llvm)
|
||||
# Replace mesa_llvm=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -968,8 +1276,7 @@ CONFIG_CSH
|
||||
|
||||
-mesa)
|
||||
# Replace mesa_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -983,8 +1290,7 @@ CONFIG_CSH
|
||||
|
||||
-vtk)
|
||||
# Replace vtk_version=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -998,8 +1304,7 @@ CONFIG_CSH
|
||||
|
||||
-llvm-path)
|
||||
# Replace LLVM_ARCH_PATH=...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -1013,8 +1318,7 @@ CONFIG_CSH
|
||||
|
||||
-mesa-path)
|
||||
# Replace MESA_ARCH_PATH...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -1028,8 +1332,7 @@ CONFIG_CSH
|
||||
|
||||
-vtk-path)
|
||||
# Replace VTK_DIR...
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
|
||||
if [ -n "$optValue" ]
|
||||
then
|
||||
@ -1053,8 +1356,7 @@ CONFIG_CSH
|
||||
-archOption | --archOption | \
|
||||
-foamInstall | --foamInstall | -projectName | --projectName)
|
||||
echo "Ignoring obsolete option: $1" 1>&2
|
||||
getOptionValue "$@"
|
||||
shift "${nOptArgs:-0}"
|
||||
getOptionValue "$@"; shift "${nOptArgs:-0}"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -39,6 +39,9 @@
|
||||
#
|
||||
# Can also disable by renaming/removing this file or by creating an empty
|
||||
# file with the same name at a user or site location.
|
||||
#
|
||||
# The leading '#config#' marker provides an edit point for
|
||||
# foamConfigurePaths
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
@ -48,8 +51,8 @@ set cgal_version=CGAL-4.14.3
|
||||
setenv BOOST_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version"
|
||||
setenv CGAL_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version"
|
||||
|
||||
# setenv GMP_ARCH_PATH ...
|
||||
# setenv MPFR_ARCH_PATH ...
|
||||
#config# setenv GMP_ARCH_PATH ...
|
||||
#config# setenv MPFR_ARCH_PATH ...
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -32,7 +32,7 @@ setenv WM_COMPILER_LIB_ARCH # Ending for lib directories
|
||||
if (! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION
|
||||
|
||||
# Adjust according to system and architecture
|
||||
switch ($WM_ARCH)
|
||||
switch ("$WM_ARCH")
|
||||
case Linux:
|
||||
setenv WM_ARCH linux
|
||||
|
||||
@ -74,11 +74,22 @@ case Linux:
|
||||
breaksw
|
||||
|
||||
# arm64 or x86_64 architectures
|
||||
# Note: /usr/bin/{gcc,g++} normally just symlinks to clang/clang++
|
||||
# which may not behave as expected.
|
||||
case Darwin:
|
||||
setenv WM_ARCH darwin64
|
||||
if ( "$WM_COMPILER" == Gcc ) then
|
||||
setenv WM_COMPILER Clang
|
||||
echo "openfoam (darwin): using clang instead of gcc"
|
||||
# Honour use of gcc, when version=... is specifed in WM_COMPILE_CONTROL
|
||||
# (eg, gcc installed via homebrew)
|
||||
if ( $?WM_COMPILE_CONTROL ) then
|
||||
if ( "$WM_COMPILE_CONTROL" =~ "*version=*" ) then
|
||||
setenv WM_COMPILER Gcc
|
||||
endif
|
||||
endif
|
||||
if ( "$WM_COMPILER" == Clang ) then
|
||||
echo "openfoam (darwin): using clang instead of gcc"
|
||||
endif
|
||||
endif
|
||||
breaksw
|
||||
|
||||
@ -214,8 +225,8 @@ _foamEtc -config compiler
|
||||
# ThirdParty base for compilers
|
||||
set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
||||
|
||||
switch ("$WM_COMPILER_TYPE-$WM_COMPILER")
|
||||
case ThirdParty-Gcc*:
|
||||
switch ("${WM_COMPILER_TYPE}/${WM_COMPILER}")
|
||||
case ThirdParty/Gcc*:
|
||||
if (! $?gmp_version ) set gmp_version=gmp-system
|
||||
if (! $?mpfr_version ) set mpfr_version=mpfr-system
|
||||
if (! $?mpc_version ) set mpc_version=mpc-system
|
||||
@ -263,7 +274,7 @@ GCC_NOT_FOUND
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case ThirdParty-Clang*:
|
||||
case ThirdParty/Clang*:
|
||||
set clangDir="$archDir/$clang_version"
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
@ -290,9 +301,9 @@ CLANG_NOT_FOUND
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case -*:
|
||||
case system-*:
|
||||
case ThirdParty-*:
|
||||
case /*:
|
||||
case system/*:
|
||||
case ThirdParty/*:
|
||||
# Using empty (system), system compiler or other ThirdParty compiler
|
||||
breaksw
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -40,6 +40,9 @@
|
||||
#
|
||||
# Can also disable by renaming/removing this file or by creating an empty
|
||||
# file with the same name at a user or site location.
|
||||
#
|
||||
# The leading '#config#' marker provides an edit point for
|
||||
# foamConfigurePaths
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
@ -49,8 +52,8 @@ cgal_version=CGAL-4.14.3
|
||||
export BOOST_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version"
|
||||
export CGAL_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version"
|
||||
|
||||
# export GMP_ARCH_PATH=...
|
||||
# export MPFR_ARCH_PATH=...
|
||||
#config# export GMP_ARCH_PATH=...
|
||||
#config# export MPFR_ARCH_PATH=...
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
@ -62,14 +65,14 @@ fi
|
||||
|
||||
if command -v _foamAddLibAuto >/dev/null # Normal sourcing (not makeCGAL)
|
||||
then
|
||||
_foamAddLibAuto $BOOST_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
|
||||
_foamAddLibAuto $CGAL_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
|
||||
_foamAddLibAuto "$BOOST_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
|
||||
_foamAddLibAuto "$CGAL_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
|
||||
|
||||
# GMP/MPFR may have already been added with ThirdParty compiler, but cannot
|
||||
# be certain so add here. Any duplicates will be removed later.
|
||||
|
||||
_foamAddLibAuto $GMP_ARCH_PATH # No fallback libdir
|
||||
_foamAddLibAuto $MPFR_ARCH_PATH # No fallback libdir
|
||||
_foamAddLibAuto "$GMP_ARCH_PATH" # No fallback libdir
|
||||
_foamAddLibAuto "$MPFR_ARCH_PATH" # No fallback libdir
|
||||
|
||||
unset boost_version cgal_version
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -47,7 +47,7 @@ fi
|
||||
if command -v _foamAddLibAuto >/dev/null # Normal sourcing (not makeFFTW)
|
||||
then
|
||||
|
||||
_foamAddLibAuto $FFTW_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
|
||||
_foamAddLibAuto "$FFTW_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
|
||||
|
||||
unset fftw_version
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -36,9 +36,9 @@ then
|
||||
# Normal sourcing (not makeAdios2)
|
||||
# Only add to PATH if the directory really exists
|
||||
|
||||
if _foamAddLibAuto $ADIOS2_ARCH_PATH
|
||||
if _foamAddLibAuto "$ADIOS2_ARCH_PATH"
|
||||
then
|
||||
_foamAddPath $ADIOS2_ARCH_PATH/bin
|
||||
_foamAddPath "$ADIOS2_ARCH_PATH"/bin
|
||||
fi
|
||||
|
||||
unset adios2_version
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2024 OpenCFD Ltd.
|
||||
# Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -41,7 +41,7 @@ if command -v _foamAddLibAuto >/dev/null
|
||||
then
|
||||
# Normal sourcing (not makeHDF5)
|
||||
|
||||
_foamAddLibAuto $HDF5_ARCH_PATH
|
||||
_foamAddLibAuto "$HDF5_ARCH_PATH"
|
||||
|
||||
unset hdf5_version
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -41,7 +41,7 @@ if command -v _foamAddLibAuto >/dev/null
|
||||
then
|
||||
# Normal sourcing (not makeHYPRE)
|
||||
|
||||
_foamAddLibAuto $HYPRE_ARCH_PATH
|
||||
_foamAddLibAuto "$HYPRE_ARCH_PATH"
|
||||
|
||||
unset hypre_version
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -41,7 +41,7 @@ if command -v _foamAddLibAuto >/dev/null
|
||||
then
|
||||
# Normal sourcing (not makePETSC)
|
||||
|
||||
_foamAddLibAuto $PETSC_ARCH_PATH
|
||||
_foamAddLibAuto "$PETSC_ARCH_PATH"
|
||||
|
||||
unset petsc_version
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -70,13 +70,21 @@ Linux)
|
||||
;;
|
||||
|
||||
# arm64 or x86_64 architectures
|
||||
# Note: /usr/bin/{gcc,g++} normally just symlinks to clang/clang++
|
||||
# which may not behave as expected.
|
||||
Darwin)
|
||||
WM_ARCH=darwin64
|
||||
# Defult to clang (not gcc) as system compiler
|
||||
if [ "$WM_COMPILER" = Gcc ]
|
||||
then
|
||||
WM_COMPILER=Clang
|
||||
echo "openfoam (darwin): using clang instead of gcc" 1>&2
|
||||
# Honour use of gcc, when version=... is specifed in WM_COMPILE_CONTROL
|
||||
# (eg, gcc installed via homebrew)
|
||||
case "$WM_COMPILE_CONTROL" in
|
||||
(*version=*) ;;
|
||||
(*)
|
||||
WM_COMPILER=Clang
|
||||
echo "openfoam (darwin): using clang instead of gcc" 1>&2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -217,8 +225,8 @@ _foamEtc -config compiler
|
||||
# ThirdParty base for compilers
|
||||
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
|
||||
|
||||
case "$WM_COMPILER_TYPE-$WM_COMPILER" in
|
||||
ThirdParty-Gcc*)
|
||||
case "${WM_COMPILER_TYPE}/${WM_COMPILER}" in
|
||||
(ThirdParty/Gcc*)
|
||||
gccDir="$archDir/$gcc_version"
|
||||
gmpDir="$archDir/${gmp_version:-gmp-system}"
|
||||
mpfrDir="$archDir/${mpfr_version:-mpfr-system}"
|
||||
@ -259,7 +267,7 @@ GCC_NOT_FOUND
|
||||
fi
|
||||
;;
|
||||
|
||||
ThirdParty-Clang*)
|
||||
(ThirdParty/Clang*)
|
||||
clangDir="$archDir/$clang_version"
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
@ -285,11 +293,11 @@ CLANG_NOT_FOUND
|
||||
fi
|
||||
;;
|
||||
|
||||
-* | system-* | ThirdParty-*)
|
||||
(/* | system/* | ThirdParty/*)
|
||||
# Using empty (system), system compiler or other ThirdParty compiler
|
||||
;;
|
||||
|
||||
*)
|
||||
(*)
|
||||
/bin/cat << UNKNOWN_TYPE 1>&2
|
||||
===============================================================================
|
||||
Unknown WM_COMPILER_TYPE="$WM_COMPILER_TYPE" - treating as 'system'
|
||||
|
||||
30
etc/config.sh/umpire
Normal file
30
etc/config.sh/umpire
Normal file
@ -0,0 +1,30 @@
|
||||
#----------------------------------*-sh-*--------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2025 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/umpire
|
||||
# [experimental]
|
||||
#
|
||||
# Description
|
||||
# Setup for UMPIRE include/libraries (usually ThirdParty installation).
|
||||
#
|
||||
# Note
|
||||
# No csh version. This file is only used by wmake.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
umpire_version=umpire-2025.03.0
|
||||
export UMPIRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$umpire_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
@ -147,6 +147,15 @@ OptimisationSwitches
|
||||
// >= 3 : when there are more than N nodes
|
||||
nodeComms.min 0;
|
||||
|
||||
// Selection of topology-aware routines (bitmask)
|
||||
// 0: disabled [default]
|
||||
// 1: broadcast [MPI]
|
||||
// 4: gather/all-gather [MPI]
|
||||
// 16: combine (reduction) [manual algorithm]
|
||||
// 32: mapGather (reduction) [manual algorithm]
|
||||
// 64: gatherList/scatterList [manual algorithm]
|
||||
topoControl 0;
|
||||
|
||||
// Transfer double as float for processor boundaries. Mostly defunct.
|
||||
floatTransfer 0;
|
||||
|
||||
|
||||
@ -3,13 +3,13 @@ MSwindows.C
|
||||
cpuInfo/cpuInfo.C
|
||||
memInfo/memInfo.C
|
||||
|
||||
signals/sigFpe.C
|
||||
signals/sigInt.C
|
||||
signals/sigQuit.C
|
||||
signals/sigSegv.C
|
||||
signals/sigStopAtWriteNow.C
|
||||
signals/sigWriteNow.C
|
||||
signals/timer.C
|
||||
signals/sigFpe.cxx
|
||||
signals/sigInt.cxx
|
||||
signals/sigQuit.cxx
|
||||
signals/sigSegv.cxx
|
||||
signals/sigStopAtWriteNow.cxx
|
||||
signals/sigWriteNow.cxx
|
||||
signals/timer.cxx
|
||||
|
||||
fileStat/fileStat.C
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,13 +50,15 @@ Description
|
||||
restores original). The class behaves as a singleton.
|
||||
|
||||
SourceFiles
|
||||
sigFpe.C
|
||||
sigFpe.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_sigFpe_H
|
||||
#define Foam_sigFpe_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <cstddef> // For std::size_t
|
||||
#include "scalarFwd.H"
|
||||
|
||||
@ -96,6 +98,23 @@ class sigFpe
|
||||
//- Handler for caught signals - ends job and prints stack
|
||||
static void sigHandler(int);
|
||||
|
||||
//- Fill (float | double) buffer with signalling NaN
|
||||
template<class FloatType>
|
||||
inline static void fill_with_NaN(FloatType* buf, size_t count)
|
||||
{
|
||||
if (buf && count)
|
||||
{
|
||||
const auto val =
|
||||
std::numeric_limits<FloatType>::signaling_NaN();
|
||||
|
||||
// [float|double] so do not need std::uninitialized_fill_n()
|
||||
// Can dispatch with
|
||||
// - std::execution::par_unseq
|
||||
// - std::execution::unseq
|
||||
std::fill_n(buf, count, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -124,6 +143,15 @@ public:
|
||||
//- True if NaN memory initialisation is currently active.
|
||||
static bool nanActive() noexcept { return nanActive_; }
|
||||
|
||||
//- Set NaN memory initialisation on/off.
|
||||
// \return the previous value
|
||||
static bool nanActive(bool on) noexcept
|
||||
{
|
||||
bool old(nanActive_);
|
||||
nanActive_ = on;
|
||||
return old;
|
||||
}
|
||||
|
||||
//- Activate SIGFPE handler when FOAM_SIGFPE is enabled.
|
||||
//- Activate fill memory with signaling_NaN when FOAM_SETNAN is enabled
|
||||
static void set(bool verbose=false);
|
||||
@ -131,11 +159,37 @@ public:
|
||||
//- Deactivate SIGFPE handler and NaN memory initialisation
|
||||
static void unset(bool verbose=false);
|
||||
|
||||
//- Fill data block with signaling_NaN values
|
||||
static void fillNan(char* buf, size_t count);
|
||||
|
||||
//- Fill data block with signaling_NaN values
|
||||
static void fillNan(UList<scalar>& list);
|
||||
//- Fill data block with signaling_NaN values if nanActive().
|
||||
//- Does a reinterpret to \c Foam::scalar
|
||||
inline static void fillNan_if(void* buf, size_t count)
|
||||
{
|
||||
if (nanActive_)
|
||||
{
|
||||
fill_with_NaN
|
||||
(
|
||||
reinterpret_cast<Foam::scalar*>(buf),
|
||||
(count/sizeof(Foam::scalar))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//- Fill data block with signaling_NaN values.
|
||||
//- Does a reinterpret to \c Foam::scalar
|
||||
static void fillNan(char* buf, size_t count)
|
||||
{
|
||||
fill_with_NaN
|
||||
(
|
||||
reinterpret_cast<Foam::scalar*>(buf),
|
||||
(count/sizeof(Foam::scalar))
|
||||
);
|
||||
}
|
||||
|
||||
//- Fill data block with (float) signaling_NaN values
|
||||
static void fillNan(UList<float>& list);
|
||||
|
||||
//- Fill data block with (double) signaling_NaN values
|
||||
static void fillNan(UList<double>& list);
|
||||
|
||||
|
||||
// Helpers
|
||||
|
||||
@ -36,11 +36,9 @@ License
|
||||
#include "Switch.H"
|
||||
|
||||
#include <float.h> // For *fp functions
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -196,37 +194,15 @@ void Foam::sigFpe::unset(bool verbose)
|
||||
}
|
||||
|
||||
|
||||
void Foam::sigFpe::fillNan(char* buf, size_t count)
|
||||
void Foam::sigFpe::fillNan(UList<float>& list)
|
||||
{
|
||||
if (!buf || !count) return;
|
||||
|
||||
// Fill with signaling_NaN
|
||||
const scalar val = std::numeric_limits<scalar>::signaling_NaN();
|
||||
|
||||
// Can dispatch with
|
||||
// - std::execution::parallel_unsequenced_policy
|
||||
// - std::execution::unsequenced_policy
|
||||
std::fill_n
|
||||
(
|
||||
reinterpret_cast<scalar*>(buf), (count/sizeof(scalar)), val
|
||||
);
|
||||
sigFpe::fill_with_NaN(list.data(), list.size());
|
||||
}
|
||||
|
||||
|
||||
void Foam::sigFpe::fillNan(UList<scalar>& list)
|
||||
void Foam::sigFpe::fillNan(UList<double>& list)
|
||||
{
|
||||
if (list.empty()) return;
|
||||
|
||||
// Fill with signaling_NaN
|
||||
const scalar val = std::numeric_limits<scalar>::signaling_NaN();
|
||||
|
||||
// Can dispatch with
|
||||
// - std::execution::parallel_unsequenced_policy
|
||||
// - std::execution::unsequenced_policy
|
||||
std::fill_n
|
||||
(
|
||||
list.data(), list.size(), val
|
||||
);
|
||||
sigFpe::fill_with_NaN(list.data(), list.size());
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ See also
|
||||
Foam::JobInfo
|
||||
|
||||
SourceFiles
|
||||
sigInt.C
|
||||
sigInt.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
#include "IOstreams.H"
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -40,7 +40,7 @@ See also
|
||||
Foam::JobInfo
|
||||
|
||||
SourceFiles
|
||||
sigQuit.C
|
||||
sigQuit.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
#include "IOstreams.H"
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
// NOTE: SIGBREAK is the best alternative to SIGQUIT on windows
|
||||
|
||||
@ -40,7 +40,7 @@ See also
|
||||
Foam::JobInfo
|
||||
|
||||
SourceFiles
|
||||
sigSegv.C
|
||||
sigSegv.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ License
|
||||
#include "IOstreams.H"
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -32,7 +32,7 @@ Description
|
||||
The interrupt is defined by OptimisationSwitches::stopAtWriteNowSignal
|
||||
|
||||
SourceFiles
|
||||
sigStopAtWriteNow.C
|
||||
sigStopAtWriteNow.cxx
|
||||
|
||||
See also
|
||||
Foam::JobInfo
|
||||
|
||||
@ -34,7 +34,7 @@ License
|
||||
#include "Time.H"
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -32,7 +32,7 @@ Description
|
||||
The interrupt is defined by OptimisationSwitches::writeNowSignal
|
||||
|
||||
SourceFiles
|
||||
sigWriteNow.C
|
||||
sigWriteNow.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
#include "Time.H"
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -27,7 +27,7 @@ Description
|
||||
File-local code for setting/resetting signal handlers.
|
||||
|
||||
SourceFiles
|
||||
signalMacros.C
|
||||
signalMacros.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -57,7 +57,7 @@ Note
|
||||
?something to do with stack frames.
|
||||
|
||||
SourceFiles
|
||||
timer.C
|
||||
timer.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ License
|
||||
#include <windows.h>
|
||||
|
||||
// File-local functions
|
||||
#include "signalMacros.C"
|
||||
#include "signalMacros.cxx"
|
||||
|
||||
#undef SIGALRM
|
||||
#define SIGALRM 14
|
||||
@ -4,12 +4,58 @@ targetType=libo # Preferred library type
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments $*
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Hack for MacOS (with Gcc).
|
||||
# The gcc compiler include path has something like this:
|
||||
# /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include
|
||||
#
|
||||
# but xcode flex installs under this:
|
||||
# /Applications/Xcode.app/Contents/Developer/
|
||||
# Toolchains/XcodeDefault.xctoolchain/usr/include
|
||||
|
||||
case "${WM_ARCH}/${WM_COMPILER}" in
|
||||
(darwin*/Gcc*)
|
||||
if [ ! -f FlexLexer.h ]
|
||||
then
|
||||
# Remove stale link(s)
|
||||
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
||||
|
||||
for include in \
|
||||
/usr/include \
|
||||
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include \
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include \
|
||||
;
|
||||
do
|
||||
if [ -f "$include"/FlexLexer.h ]
|
||||
then
|
||||
echo "Adding FlexLexer.h link to ${PWD##*/} (darwin/gcc)" 1>&2
|
||||
ln -sf "$include"/FlexLexer.h FlexLexer.h
|
||||
|
||||
if [ -d lnInclude ]
|
||||
then
|
||||
(cd lnInclude && ln -sf ../FlexLexer.h .)
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
(*)
|
||||
if [ -f FlexLexer.h ]
|
||||
then
|
||||
echo "Removing old FlexLexer.h link from ${PWD##*/}" 1>&2
|
||||
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
# If <sys/inotify.h> is available (Linux)
|
||||
if [ -f /usr/include/sys/inotify.h ]
|
||||
then
|
||||
echo " found <sys/inotify.h> -- enabling inotify for file monitoring."
|
||||
echo " found <sys/inotify.h> -- using inotify for file monitoring" 1>&2
|
||||
export COMP_FLAGS="-DFOAM_USE_INOTIFY"
|
||||
fi
|
||||
|
||||
|
||||
@ -4,15 +4,14 @@ cpuInfo/cpuInfo.C
|
||||
cpuTime/cpuTimePosix.C
|
||||
memInfo/memInfo.C
|
||||
|
||||
signals/sigFpe.C
|
||||
signals/sigSegv.C
|
||||
signals/sigInt.C
|
||||
signals/sigQuit.C
|
||||
signals/sigStopAtWriteNow.C
|
||||
signals/sigWriteNow.C
|
||||
signals/timer.C
|
||||
signals/sigFpe.cxx
|
||||
signals/sigSegv.cxx
|
||||
signals/sigInt.cxx
|
||||
signals/sigQuit.cxx
|
||||
signals/sigStopAtWriteNow.cxx
|
||||
signals/sigWriteNow.cxx
|
||||
signals/timer.cxx
|
||||
|
||||
regExp/regExpPosix.C
|
||||
fileStat/fileStat.C
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user