CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

tailor made class, wmake libso successfully, but run failed.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2014, 21:55
Default tailor made class, wmake libso successfully, but run failed.
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
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;
}
This is my main function:
Code:
int main(int argc, char *argv[])
    {
	scalarDiagonalMatrix m(4, scalar(1));
	Info << m << endl;
	gaussianDistribution(4.0, m, 1);
	return 0;
    }
You can see that I just wanna see if this class works. But it said:

Code:
a@a:~/OpenFOAM/myCase/momentsinversion$ C
4{1}
Segmentation fault (core dumped)
a@a:~/OpenFOAM/myCase/momentsinversion$
Any ideas? Thanks

Solved..gaussianDistribution(4.0, m, 4) works.
sharonyue is offline   Reply With Quote

Old   November 20, 2014, 21:49
Default
  #2
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 13
huangxianbei is on a distinguished road
Hi:
Could you please explain a little bit about how to use the new namespace when it's compiled with wmake libso?

Xianbei
huangxianbei is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transient boundary conditions Jarrod Sinclair (Sinclair) OpenFOAM Running, Solving & CFD 133 May 6, 2015 06: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 17:34
compiling firefoam Farshad_Noravesh OpenFOAM 27 December 24, 2012 04:21
[OpenFOAM] ParaFoam error message joey ParaView 1 October 2, 2006 13:28
how to run successfully? blue moon Phoenics 5 May 22, 2001 09:00


All times are GMT -4. The time now is 10:33.