Closed abzrg closed 9 months ago
I also used g++-5 and g++-7, and it didn't help.
I then went to recompile OpenFOAM-7 from scratch (git clean -xdf
), and it too didn't solve the problem.
As stated in those previous issues, I cant fix a problem that I cant reproduce. Re-install OS and openfoam from scratch in a Vbox and it should work.
Anyway, the issue is around line 147 of this file (and similar ones that will appear once you fix that): https://github.com/fppimenta/rheoTool/blob/master/of70/src/libs/fvmb/operators/div.C which reads:
labelList cT(6,-1);
Just make some workaround (and I can imagine different ones) and it should work too.
Thanks for the pointer. Btw, I should read template errors more carefully (:
After fixing the problem, I believe I now understand why you don't encounter this problem. The reason is that you install OpenFOAM in a standard way, which is slightly different from the way probably a small group OpenFOAM users install it. By that, I mean following this particular tutorial. In that tutorial there's a section that goes like following:
For building with the normal 64-bit integer support (maximum 9.22×1018 cells, faces or points):
source $HOME/OpenFOAM/OpenFOAM-7/etc/bashrc WM_LABEL_SIZE=64 FOAMY_HEX_MESH=yes
And there lies the problem: WM_LABEL_SIZE=64
.
Removing this or changing 64 to 32 will fix the problem and code compiles successfully, as expected. Now, I don't know whether it produce any side-effects when OpenFOAM is compiled with 64-bit label
while rheoTool with 32-bit label
.
On the other hand, having a 64-bit label
, I went through and fixed the errors to the end of the compilation, which was basically some casting operations from either int
to label
, or label*
to const <specialIntType>*
, which is either some PETSc's or Hypre's integers types.
If you're interested in adding support for the 64-bit label
, I can send a PR.
Anyway, the issue is around line 147 of this file (and similar ones that will appear once you fix that): https://github.com/fppimenta/rheoTool/blob/master/of70/src/libs/fvmb/operators/div.C which reads:
labelList cT(6,-1);
Just make some workaround (and I can imagine different ones) and it should work too.
At the very least, that bit of code needs to be written as follows:
labelList cT(label(6), -1);
which ensures that the first argument is treated as a label
, even in the 64-bit compilation. However, since these are actually fixed sizes it does not make sense to allocate from the heap for these. Instead:
FixedList<label, 6> cT(-1);
Similarly, later on there is a List<labelList>
that is only used to manage row/column addressing. Better to write
List<labelPair> ...
Here's also all the spots I have changed to fix the compilation errors (with 64bit integer):
diff --git a/of70/src/libs/brownianDynamics/sPCloudInterface.C b/of70/src/libs/brownianDynamics/sPCloudInterface.C
index 196b40f..a742680 100755
--- a/of70/src/libs/brownianDynamics/sPCloudInterface.C
+++ b/of70/src/libs/brownianDynamics/sPCloudInterface.C
@@ -132,7 +132,7 @@ spModel_()
mAct_.set
(
i,
- new List<label>(3,0)
+ new List<label>(static_cast<label>(3),static_cast<label>(0))
);
mAct_[i] = actMolc_[i];
@@ -142,7 +142,7 @@ spModel_()
mIds_.set
(
i,
- new List<List<label> >(nBeads, List<label>(3,0))
+ new List<List<label> >(nBeads, List<label>(static_cast<label>(3),static_cast<label>(0)))
);
// Create positions
@@ -197,7 +197,7 @@ spModel_()
mSpr_.set
(
i,
- new List<List<label> >(nBeads-1, List<label>(3,0))
+ new List<List<label> >(nBeads-1, List<label>(static_cast<label>(3),static_cast<label>(0)))
);
// Find max active id for the linking matrix
diff --git a/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H b/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
index 5221259..c9d72df 100755
--- a/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
+++ b/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
@@ -75,7 +75,7 @@ void sPCloudInterface::writeRunTimeInfoDict()
)
);
- List<List<label> > actMolc_(nMolc_, List<label>(3,0));
+ List<List<label> > actMolc_(nMolc_, List<label>(static_cast<label>(3),static_cast<label>(0)));
// We have to update the active molecules
int j(0);
diff --git a/of70/src/libs/brownianDynamics/solidParticleCloud.C b/of70/src/libs/brownianDynamics/solidParticleCloud.C
index a08c18e..fa52f70 100755
--- a/of70/src/libs/brownianDynamics/solidParticleCloud.C
+++ b/of70/src/libs/brownianDynamics/solidParticleCloud.C
@@ -48,7 +48,7 @@ Foam::solidParticleCloud::solidParticleCloud
IOobject::NO_WRITE
)
),
- molcToDelete_(1,-1),
+ molcToDelete_(static_cast<label>(1),static_cast<label>(-1)),
wallRepX_(readScalar(molcProperties_.subDict("exclusionVolumeProperties").lookup("repulsiveDistance"))),
isTethered_(readBool(molcProperties_.subDict("externalFlow").lookup("tethered"))),
extForcInt_(externalForcingInterp::New(mesh, molcProperties_))
diff --git a/of70/src/libs/fvmb/operators/div.C b/of70/src/libs/fvmb/operators/div.C
index 251ed17..334742b 100755
--- a/of70/src/libs/fvmb/operators/div.C
+++ b/of70/src/libs/fvmb/operators/div.C
@@ -144,7 +144,7 @@ tmp< LMatrix<tensor> > div
);
int i = 0;
- labelList cT(6,-1);
+ labelList cT(static_cast<label>(6),static_cast<label>(-1));
forAll(cT, cmpt)
{
if (component(validComponentsT, cmpt) == -1) continue;
@@ -160,7 +160,7 @@ tmp< LMatrix<tensor> > div
);
i = 0;
- labelList cV(3,-1);
+ labelList cV(static_cast<label>(3),static_cast<label>(-1));
forAll(cV, cmpt)
{
if (component(validComponentsV, cmpt) == -1) continue;
diff --git a/of70/src/libs/fvmb/operators/twoSymmGrad.C b/of70/src/libs/fvmb/operators/twoSymmGrad.C
index aae89be..7024061 100755
--- a/of70/src/libs/fvmb/operators/twoSymmGrad.C
+++ b/of70/src/libs/fvmb/operators/twoSymmGrad.C
@@ -185,7 +185,7 @@ tmp< LMatrix<tensor> > twoSymmGrad
);
int i = 0;
- labelList cT(6,-1);
+ labelList cT(static_cast<label>(6),static_cast<label>(-1));
forAll(cT, cmpt)
{
if (component(validComponentsT, cmpt) == -1) continue;
@@ -201,7 +201,7 @@ tmp< LMatrix<tensor> > twoSymmGrad
);
i = 0;
- labelList cV(3,-1);
+ labelList cV(static_cast<label>(3),static_cast<label>(-1));
forAll(cV, cmpt)
{
if (component(validComponentsV, cmpt) == -1) continue;
diff --git a/of70/src/libs/preProcessing/initMolecules/initMolecules.C b/of70/src/libs/preProcessing/initMolecules/initMolecules.C
index 6e91036..1828f15 100755
--- a/of70/src/libs/preProcessing/initMolecules/initMolecules.C
+++ b/of70/src/libs/preProcessing/initMolecules/initMolecules.C
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
// Find the number of molecules
int nAllMolc(0); int nM(0);
- int nAllbeads(0);
+ label nAllbeads(0);
forAll(allG, i)
{
allG[i].dict().lookup("nMolecules") >> nM;
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
)
);
- List<List<label> > actMolc_(nAllMolc, List<label>(3,0));
+ List<List<label> > actMolc_(nAllMolc, List<label>(static_cast<label>(3),static_cast<label>(0)));
//-- Group properties
List<word> names(allG.size(), "");
@@ -355,7 +355,7 @@ int main(int argc, char *argv[])
label ri(0);
label gi(0);
label jprev(0);
- List<label> tmp(3,0);
+ List<label> tmp(static_cast<label>(3),static_cast<label>(0));
forAll(allG, i)
{
int nM(0);
@@ -482,7 +482,7 @@ int createMoleculesGI
}
// loc. ID bead i-1 | loc. ID bead i | molcID
- List<List<label> > spr(nSpr*p0.size(), List<label>(3, 0) );
+ List<List<label> > spr(nSpr*p0.size(), List<label>(static_cast<label>(3), static_cast<label>(0)) );
Field<Field<label> > ind(tnb*p0.size(), Field<label>(3, 0) );
diff --git a/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C b/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
index de524d5..15f9f99 100755
--- a/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
@@ -373,8 +373,8 @@ void Foam::coupledSolver::createSystem()
if (topoChanging || maxInProcBlocks_.size() == 0 || (isThereCyclicAMI_ && changing))
computeAllocationPetsc(nloc, nglb);
- ierr = MatSeqAIJSetPreallocation(A,0,maxInProcBlocks_.begin());
- ierr = MatMPIAIJSetPreallocation(A,0,maxInProcBlocks_.begin(),0,maxOutProcBlocks_.begin());
+ ierr = MatSeqAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcBlocks_.begin()));
+ ierr = MatMPIAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcBlocks_.begin()),0,reinterpret_cast<const PetscInt*>(maxOutProcBlocks_.begin()));
// ierr = MatSetUp(A);CHKERRV(ierr);
diff --git a/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C b/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
index 275a1c7..178a95a 100755
--- a/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
@@ -885,7 +885,7 @@ void Foam::hypreSolver<Type>::assembleHypreAbx
if (Pstream::parRun())
{
- HYPRE_IJMatrixSetDiagOffdSizes(A, maxInProcFaces_.begin(), maxOutProcFaces_.begin());
+ HYPRE_IJMatrixSetDiagOffdSizes(A, reinterpret_cast<const HYPRE_Int*>(maxInProcFaces_.begin()), reinterpret_cast<const HYPRE_Int*>(maxOutProcFaces_.begin()));
}
else
{
@@ -1006,8 +1006,8 @@ void Foam::hypreSolver<Type>::assembleHypreAbx
A,
1,
&nnz,
- &this->sharedData[meshID_].fCo[pI][facei],
- &this->sharedData[meshID_].fCn[pI][facei],
+ reinterpret_cast<const HYPRE_BigInt*>(&this->sharedData[meshID_].fCo[pI][facei]),
+ reinterpret_cast<const HYPRE_BigInt*>(&this->sharedData[meshID_].fCn[pI][facei]),
&v
);
}
diff --git a/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C b/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
index 9abbfd0..d115c23 100644
--- a/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
@@ -873,8 +873,8 @@ void Foam::petscSolver<Type>::assemblePetscAbx
if (T.mesh().topoChanging() || maxInProcFaces_.size() == 0 || (isThereCyclicAMI_ && T.mesh().changing()))
computeAllocationPetsc(eqn, T);
- ierr = MatSeqAIJSetPreallocation(A,0,maxInProcFaces_.begin());
- ierr = MatMPIAIJSetPreallocation(A,0,maxInProcFaces_.begin(),0,maxOutProcFaces_.begin());CHKERRV(ierr);
+ ierr = MatSeqAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcFaces_.begin()));
+ ierr = MatMPIAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcFaces_.begin()),0,reinterpret_cast<const PetscInt*>(maxOutProcFaces_.begin()));CHKERRV(ierr);
// Use this (let PETSC allocate on its own) if the above is not working
// ierr = MatSetUp(A);CHKERRV(ierr);
@@ -985,9 +985,9 @@ void Foam::petscSolver<Type>::assemblePetscAbx
(
A,
1,
- &this->sharedData[meshID_].fCo[pI][facei],
+ reinterpret_cast<const PetscInt*>(&this->sharedData[meshID_].fCo[pI][facei]),
1,
- &this->sharedData[meshID_].fCn[pI][facei],
+ reinterpret_cast<const PetscInt*>(&this->sharedData[meshID_].fCn[pI][facei]),
&v,
INSERT_VALUES
);
Generally preferred to use Foam::zero instead of static_cast
, so these should compile without ambiguity:
List<label>(3, Zero);
List<label>(3, Foam::zero{});
Since there is only one constructor form with Foam::zero
as the second parameter, the first parameter will be cast from int to int32_t or int64_t (ie, label) without ambiguity. This form is also advantageous when dealing with other types. For example,
List<tensor>(10, Zero);
Note that your changes with reinterpret_cast (for PETSc etc) are likely to be erroneous. Take a look at the PrecisionAdaptor for other ways to recast/convert.
Thank you @olesenm for your comments and suggestions on the patch.
For static conversions I modified the code according to your suggestions. However, I couldn't find PrecisionAdaptor
in OpenFOAM-7 source code (in src/OpenFOAM/memory
). Is there anything similar to that in OpenFOAM-7?
Here's the updated patch:
diff --git a/of70/src/libs/brownianDynamics/sPCloudInterface.C b/of70/src/libs/brownianDynamics/sPCloudInterface.C
index 196b40f..aedd0aa 100755
--- a/of70/src/libs/brownianDynamics/sPCloudInterface.C
+++ b/of70/src/libs/brownianDynamics/sPCloudInterface.C
@@ -132,7 +132,7 @@ spModel_()
mAct_.set
(
i,
- new List<label>(3,0)
+ new List<label>(3,Foam::Zero)
);
mAct_[i] = actMolc_[i];
@@ -142,7 +142,7 @@ spModel_()
mIds_.set
(
i,
- new List<List<label> >(nBeads, List<label>(3,0))
+ new List<List<label> >(nBeads, List<label>(3, Foam::Zero))
);
// Create positions
@@ -197,7 +197,7 @@ spModel_()
mSpr_.set
(
i,
- new List<List<label> >(nBeads-1, List<label>(3,0))
+ new List<List<label> >(nBeads-1, List<label>(3, Foam::Zero))
);
// Find max active id for the linking matrix
diff --git a/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H b/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
index 5221259..27cc257 100755
--- a/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
+++ b/of70/src/libs/brownianDynamics/sPCloudInterfaceIO.H
@@ -75,7 +75,7 @@ void sPCloudInterface::writeRunTimeInfoDict()
)
);
- List<List<label> > actMolc_(nMolc_, List<label>(3,0));
+ List<List<label> > actMolc_(nMolc_, List<label>(3, Foam::Zero));
// We have to update the active molecules
int j(0);
diff --git a/of70/src/libs/brownianDynamics/solidParticleCloud.C b/of70/src/libs/brownianDynamics/solidParticleCloud.C
index a08c18e..17f5b7f 100755
--- a/of70/src/libs/brownianDynamics/solidParticleCloud.C
+++ b/of70/src/libs/brownianDynamics/solidParticleCloud.C
@@ -48,7 +48,7 @@ Foam::solidParticleCloud::solidParticleCloud
IOobject::NO_WRITE
)
),
- molcToDelete_(1,-1),
+ molcToDelete_(1,static_cast<label>(-1)),
wallRepX_(readScalar(molcProperties_.subDict("exclusionVolumeProperties").lookup("repulsiveDistance"))),
isTethered_(readBool(molcProperties_.subDict("externalFlow").lookup("tethered"))),
extForcInt_(externalForcingInterp::New(mesh, molcProperties_))
diff --git a/of70/src/libs/fvmb/operators/div.C b/of70/src/libs/fvmb/operators/div.C
index 251ed17..1012117 100755
--- a/of70/src/libs/fvmb/operators/div.C
+++ b/of70/src/libs/fvmb/operators/div.C
@@ -144,7 +144,7 @@ tmp< LMatrix<tensor> > div
);
int i = 0;
- labelList cT(6,-1);
+ FixedList<label, 6> cT(-1);
forAll(cT, cmpt)
{
if (component(validComponentsT, cmpt) == -1) continue;
@@ -160,7 +160,7 @@ tmp< LMatrix<tensor> > div
);
i = 0;
- labelList cV(3,-1);
+ FixedList<label, 3> cV(-1);
forAll(cV, cmpt)
{
if (component(validComponentsV, cmpt) == -1) continue;
@@ -170,7 +170,7 @@ tmp< LMatrix<tensor> > div
}
// Fill the row-col-cmpt list
- List<labelList> VT({
+ List<labelPair> VT({
{cV[0],cT[0]}, {cV[0],cT[1]}, {cV[0],cT[2]},
{cV[1],cT[1]}, {cV[1],cT[3]}, {cV[1],cT[4]},
{cV[2],cT[2]}, {cV[2],cT[4]}, {cV[2],cT[5]}
diff --git a/of70/src/libs/fvmb/operators/twoSymmGrad.C b/of70/src/libs/fvmb/operators/twoSymmGrad.C
index aae89be..72c0b23 100755
--- a/of70/src/libs/fvmb/operators/twoSymmGrad.C
+++ b/of70/src/libs/fvmb/operators/twoSymmGrad.C
@@ -185,7 +185,7 @@ tmp< LMatrix<tensor> > twoSymmGrad
);
int i = 0;
- labelList cT(6,-1);
+ FixedList<label, 6> cT(-1);
forAll(cT, cmpt)
{
if (component(validComponentsT, cmpt) == -1) continue;
@@ -201,7 +201,7 @@ tmp< LMatrix<tensor> > twoSymmGrad
);
i = 0;
- labelList cV(3,-1);
+ FixedList<label, 3> cV(-1);
forAll(cV, cmpt)
{
if (component(validComponentsV, cmpt) == -1) continue;
diff --git a/of70/src/libs/preProcessing/initMolecules/initMolecules.C b/of70/src/libs/preProcessing/initMolecules/initMolecules.C
index 6e91036..c436cc6 100755
--- a/of70/src/libs/preProcessing/initMolecules/initMolecules.C
+++ b/of70/src/libs/preProcessing/initMolecules/initMolecules.C
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
// Find the number of molecules
int nAllMolc(0); int nM(0);
- int nAllbeads(0);
+ label nAllbeads(0);
forAll(allG, i)
{
allG[i].dict().lookup("nMolecules") >> nM;
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
)
);
- List<List<label> > actMolc_(nAllMolc, List<label>(3,0));
+ List<List<label> > actMolc_(nAllMolc, List<label>(3, Foam::Zero));
//-- Group properties
List<word> names(allG.size(), "");
@@ -355,7 +355,7 @@ int main(int argc, char *argv[])
label ri(0);
label gi(0);
label jprev(0);
- List<label> tmp(3,0);
+ List<label> tmp(3, Foam::Zero);
forAll(allG, i)
{
int nM(0);
@@ -482,7 +482,7 @@ int createMoleculesGI
}
// loc. ID bead i-1 | loc. ID bead i | molcID
- List<List<label> > spr(nSpr*p0.size(), List<label>(3, 0) );
+ List<List<label> > spr(nSpr*p0.size(), List<label>(3, Foam::Zero) );
Field<Field<label> > ind(tnb*p0.size(), Field<label>(3, 0) );
diff --git a/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C b/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
index de524d5..15f9f99 100755
--- a/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/coupled/coupledSolver.C
@@ -373,8 +373,8 @@ void Foam::coupledSolver::createSystem()
if (topoChanging || maxInProcBlocks_.size() == 0 || (isThereCyclicAMI_ && changing))
computeAllocationPetsc(nloc, nglb);
- ierr = MatSeqAIJSetPreallocation(A,0,maxInProcBlocks_.begin());
- ierr = MatMPIAIJSetPreallocation(A,0,maxInProcBlocks_.begin(),0,maxOutProcBlocks_.begin());
+ ierr = MatSeqAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcBlocks_.begin()));
+ ierr = MatMPIAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcBlocks_.begin()),0,reinterpret_cast<const PetscInt*>(maxOutProcBlocks_.begin()));
// ierr = MatSetUp(A);CHKERRV(ierr);
diff --git a/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C b/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
index 275a1c7..178a95a 100755
--- a/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/segregated/hypreSolver/hypreSolver.C
@@ -885,7 +885,7 @@ void Foam::hypreSolver<Type>::assembleHypreAbx
if (Pstream::parRun())
{
- HYPRE_IJMatrixSetDiagOffdSizes(A, maxInProcFaces_.begin(), maxOutProcFaces_.begin());
+ HYPRE_IJMatrixSetDiagOffdSizes(A, reinterpret_cast<const HYPRE_Int*>(maxInProcFaces_.begin()), reinterpret_cast<const HYPRE_Int*>(maxOutProcFaces_.begin()));
}
else
{
@@ -1006,8 +1006,8 @@ void Foam::hypreSolver<Type>::assembleHypreAbx
A,
1,
&nnz,
- &this->sharedData[meshID_].fCo[pI][facei],
- &this->sharedData[meshID_].fCn[pI][facei],
+ reinterpret_cast<const HYPRE_BigInt*>(&this->sharedData[meshID_].fCo[pI][facei]),
+ reinterpret_cast<const HYPRE_BigInt*>(&this->sharedData[meshID_].fCn[pI][facei]),
&v
);
}
diff --git a/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C b/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
index 9abbfd0..d115c23 100644
--- a/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
+++ b/of70/src/libs/sparseMatrixSolvers/segregated/petscSolver/petscSolver.C
@@ -873,8 +873,8 @@ void Foam::petscSolver<Type>::assemblePetscAbx
if (T.mesh().topoChanging() || maxInProcFaces_.size() == 0 || (isThereCyclicAMI_ && T.mesh().changing()))
computeAllocationPetsc(eqn, T);
- ierr = MatSeqAIJSetPreallocation(A,0,maxInProcFaces_.begin());
- ierr = MatMPIAIJSetPreallocation(A,0,maxInProcFaces_.begin(),0,maxOutProcFaces_.begin());CHKERRV(ierr);
+ ierr = MatSeqAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcFaces_.begin()));
+ ierr = MatMPIAIJSetPreallocation(A,0,reinterpret_cast<const PetscInt*>(maxInProcFaces_.begin()),0,reinterpret_cast<const PetscInt*>(maxOutProcFaces_.begin()));CHKERRV(ierr);
// Use this (let PETSC allocate on its own) if the above is not working
// ierr = MatSetUp(A);CHKERRV(ierr);
@@ -985,9 +985,9 @@ void Foam::petscSolver<Type>::assemblePetscAbx
(
A,
1,
- &this->sharedData[meshID_].fCo[pI][facei],
+ reinterpret_cast<const PetscInt*>(&this->sharedData[meshID_].fCo[pI][facei]),
1,
- &this->sharedData[meshID_].fCn[pI][facei],
+ reinterpret_cast<const PetscInt*>(&this->sharedData[meshID_].fCn[pI][facei]),
&v,
INSERT_VALUES
);
If there is no PrecisionAdaptor in your target codebase, you could always bring it across and given it a different file name. Eg,
// RheoToolPrecisionAdaptor
#ifndef RheoTool_PrecisionAdaptor_H
#define RheoTool_PrecisionAdaptor_H
#ifdef OPENFOAM
#include "PrecisionAdaptor.H"
#else
// Code taken from openfoam.com (commit: xxxx):
....
#endif
You will need to do something like that, otherwise the casts to PetscInt *
etc could be very, very wrong.
I read two other issues related to this problem (#39 and #28), but they didn't help...
Here's some information:
uname -a
:Linux isengard 5.15.0-91-generic #101~20.04.1-Ubuntu SMP Thu Nov 16 14:22:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
WM_PROJECT_VERSION
:7
(I compiled OpenFOAM-7)WM_COMPILE_TYPE
:system
WM_COMPILER
:Gcc
g++ --version
:g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
wmake/rules/linux.../c++
file), and got the same resultinstallPetsc
anddownloadEigen
Here's how I load OpenFOAM environment:
Here's the build log: