|
[Sponsors] |
tailor made class, wmake libso successfully, but run failed. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 2, 2014, 22:55 |
tailor made class, wmake libso successfully, but run failed.
|
#1 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 848
Rep Power: 18 |
Hi guys,
This is my class: class definition: Code:
namespace Foam { /*---------------------------------------------------------------------------*\ Class gaussianDistribution Declaration \*---------------------------------------------------------------------------*/ class gaussianDistribution { private: // Private data //- Parameter sigma double sigma_; //- Moments from previous value const scalarDiagonalMatrix moments_; //- Quadrature weights scalarDiagonalMatrix weights_; //- Quadrature abscissas scalarDiagonalMatrix abscissas_; //- Number of weights and abscissas const label nWeights_; //- Number of moments const label nMoments_; //- Private member functions //- Disallow default bitwise copy construct gaussianDistribution(const gaussianDistribution&); //- Disallow default bitwise assignment void operator=(const gaussianDistribution&); public: // Constructors //- Construct from a scalarSquareMatrix gaussianDistribution ( const double& sigma, const scalarDiagonalMatrix& moments, const label nWeights ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } Code:
Foam::gaussianDistribution::gaussianDistribution ( const double& sigma, const scalarDiagonalMatrix& moments, const label nWeights ) : sigma_(sigma), moments_(moments), weights_(nWeights), abscissas_(nWeights), nWeights_(nWeights), nMoments_(nWeights*2) { scalarDiagonalMatrix we(nWeights_, scalar(0)); scalarDiagonalMatrix abs(nWeights_, scalar(0)); scalarSquareMatrix A(nMoments_, nMoments_, scalar(0)); // Construct A matrix A[2][0] = Foam::pow(sigma_,2); A[3][1] = Foam::pow(sigma_,2); Info << A <<endl; } Code:
int main(int argc, char *argv[]) { scalarDiagonalMatrix m(4, scalar(1)); Info << m << endl; gaussianDistribution(4.0, m, 1); return 0; } Code:
a@a:~/OpenFOAM/myCase/momentsinversion$ C 4{1} Segmentation fault (core dumped) a@a:~/OpenFOAM/myCase/momentsinversion$ Solved..gaussianDistribution(4.0, m, 4) works. |
|
November 20, 2014, 22:49 |
|
#2 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Hi:
Could you please explain a little bit about how to use the new namespace when it's compiled with wmake libso? Xianbei |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transient boundary conditions | Jarrod Sinclair (Sinclair) | OpenFOAM Running, Solving & CFD | 133 | May 6, 2015 07:21 |
[solidMechanics] Building solidMechanics in OpenFOAM 1.6-ext on Mac OS X | codder | OpenFOAM CC Toolkits for Fluid-Structure Interaction | 4 | January 11, 2014 18:34 |
compiling firefoam | Farshad_Noravesh | OpenFOAM | 27 | December 24, 2012 05:21 |
[OpenFOAM] ParaFoam error message | joey | ParaView | 1 | October 2, 2006 14:28 |
how to run successfully? | blue moon | Phoenics | 5 | May 22, 2001 10:00 |