![]() |
Blitz Support : |
From: Ben McLean \(finlaylabs\) (bmclean_at_[hidden])
Date: 2003-11-11 00:56:57
Hi all,
after downloading basic cygwin and adding in gcc, make, etc, I have been able to (error-free) make Blitz. Very impressive! A bit of jiggling in Dev-C++ and it is a useable tool already. Well done and thanks.
All the docs and examples use
using namespace blitz;
As I am (trying to) use blitz as part of a larger multi-class project i do not want to use namespace blitz, rather i would prefer to use a constructor to create instances of Array or whatever that I can use in main or from any other class, especially if i actually create arrays in a class functiuon outside of main. What is the syntax for doing this? My best guesses do not work, an example guess that may clarify what i am trying to do is below. I would appreciate edits / comments on the basic example below from anyone who can show me how to do this.
Thanks, Ben.
____________________________________________
// main()
using namespace std;
#include "Data.h"
#include "blitz/array.h"
Data *myData;
Array myArray; //or use Blitz::Array myArray; or blitz myBlitz;, something... need help here
int main(int argc, char *argv[]){
Data::initializeArrays();
cout << "Array test2D = " << myArray.test2D << endl;//access an array created
// within another class
return(0);
}
_____________________________________________
// Data.cpp
#include "Data.h"
#include "blitz/array.h"
int initializeArrays(){
int nx=ny = 3;
blitz::Array<double,2> test2D(nx,ny);//made the array here,
// but want to access it from main() or elsewhere
test2D = 0.0;
return(0);
}
_____________________________________________
// Data.h
#include "blitz/array.h"
class Data{
public:
Data(Params *myParams);//constructor
~Data();//destructor
int initializeArrays();
};