@@ -290,9 +290,6 @@ template <int D, typename T> void FunctionTree<D, T>::loadTreeTXT(const std::str
290290 * @param[in] file: File name
291291 */
292292template <int D, typename T> void FunctionTree<D, T>::saveTreeTXT(const std::string &fname) {
293- int nRoots = this ->getRootBox ().size ();
294- MWNode<D, T> **roots = this ->getRootBox ().getNodes ();
295-
296293 std::ofstream out (fname);
297294 out << std::setprecision (14 );
298295 out << D << std::endl;
@@ -306,7 +303,7 @@ template <int D, typename T> void FunctionTree<D, T>::saveTreeTXT(const std::str
306303 int ncoefs = 1 ;
307304 for (int d = 0 ; d < D; d++) ncoefs *= kp1;
308305 int Tdim = std::pow (2 , D);
309- T values[ ncoefs * Tdim] ;
306+ std::vector<T> values ( ncoefs * Tdim) ;
310307
311308 int nout = this ->endNodeTable .size ();
312309 out << Tdim * nout << std::endl; // could output only scaling coeff?
@@ -334,7 +331,7 @@ template <int D, typename T> void FunctionTree<D, T>::saveTreeTXT(const std::str
334331 MWNode<D, T> *node = &(this ->getNode (idx, false ));
335332 T *coefs = node->getCoefs ();
336333 for (int i = 0 ; i < ncoefs * Tdim; i++) values[i] = coefs[i];
337- node->attachCoefs (values);
334+ node->attachCoefs (values. data () );
338335 int n = idx.getScale ();
339336 node->mwTransform (Reconstruction);
340337 node->cvTransform (Forward);
@@ -443,7 +440,6 @@ template <> double FunctionTree<3, double>::integrateEndNodes(RepresentableFunct
443440 // traverse tree, and treat end nodes only
444441 std::vector<FunctionNode<3 > *> stack; // node from this
445442 for (int i = 0 ; i < this ->getRootBox ().size (); i++) stack.push_back (&(this ->getRootFuncNode (i)));
446- int basis = getMRA ().getScalingBasis ().getScalingType ();
447443 double result = 0.0 ;
448444 while (stack.size () > 0 ) {
449445 FunctionNode<3 > *Node = stack.back ();
@@ -456,9 +452,9 @@ template <> double FunctionTree<3, double>::integrateEndNodes(RepresentableFunct
456452 double *coefs = Node->getCoefs (); // save position of coeff, but do not use them!
457453 // The data in fmat is not organized so that two consecutive points are stored after each other in memory, so needs to copy before mwtransform, cannot use memory adress directly.
458454 int nc = fmat.cols ();
459- double cc[nc] ;
455+ std::vector< double > cc (nc) ;
460456 for (int i = 0 ; i < nc; i++) cc[i] = fmat (0 , i);
461- Node->attachCoefs (cc);
457+ Node->attachCoefs (cc. data () );
462458 result += Node->integrateValues ();
463459 Node->attachCoefs (coefs); // put back original coeff
464460 }
@@ -880,8 +876,6 @@ void FunctionTree<D, T>::makeCoeffVector(std::vector<T *> &coefs,
880876 indices.clear ();
881877 parent_indices.clear ();
882878 max_index = 0 ;
883- int sizecoeff = (1 << refTree.getDim ()) * refTree.getKp1_d ();
884- int sizecoeffW = ((1 << refTree.getDim ()) - 1 ) * refTree.getKp1_d ();
885879 std::vector<MWNode<D, double > *> refstack; // nodes from refTree
886880 std::vector<MWNode<D, T> *> thisstack; // nodes from this Tree
887881 for (int rIdx = 0 ; rIdx < this ->getRootBox ().size (); rIdx++) {
@@ -1096,7 +1090,6 @@ template <> int FunctionTree<3, double>::saveNodesAndRmCoeff() {
10961090 for (int rIdx = 0 ; rIdx < this ->getRootBox ().size (); rIdx++) { stack.push_back (this ->getRootBox ().getNodes ()[rIdx]); }
10971091 while (stack.size () > stack_p) {
10981092 MWNode<3 , double > *Node = stack[stack_p++];
1099- int id = 0 ;
11001093 NodesCoeff->put_data (Node->getNodeIndex (), sizecoeff, Node->getCoefs ());
11011094 for (int i = 0 ; i < Node->getNChildren (); i++) { stack.push_back (Node->children [i]); }
11021095 }
@@ -1119,7 +1112,6 @@ template <> int FunctionTree<3, ComplexDouble>::saveNodesAndRmCoeff() {
11191112 for (int rIdx = 0 ; rIdx < this ->getRootBox ().size (); rIdx++) { stack.push_back (this ->getRootBox ().getNodes ()[rIdx]); }
11201113 while (stack.size () > stack_p) {
11211114 MWNode<3 , ComplexDouble> *Node = stack[stack_p++];
1122- int id = 0 ;
11231115 NodesCoeff->put_data (Node->getNodeIndex (), sizecoeff, Node->getCoefs ());
11241116 for (int i = 0 ; i < Node->getNChildren (); i++) { stack.push_back (Node->children [i]); }
11251117 }
@@ -1195,7 +1187,6 @@ template <int D, typename T> FunctionTree<D, double> *FunctionTree<D, T>::Imag()
11951187
11961188template <> void FunctionTree<3 , double >::CopyTreeToComplex(FunctionTree<3 , ComplexDouble> *&outTree) {
11971189 delete outTree;
1198- double ref = 0.0 ;
11991190 outTree = new FunctionTree<3 , ComplexDouble>(this ->getMRA ());
12001191 std::vector<MWNode<3 , double > *> instack; // node from this
12011192 std::vector<MWNode<3 , ComplexDouble> *> outstack; // node from outTree
@@ -1204,7 +1195,6 @@ template <> void FunctionTree<3, double>::CopyTreeToComplex(FunctionTree<3, Comp
12041195 instack.push_back (this ->getRootBox ().getNodes ()[rIdx]);
12051196 outstack.push_back (outTree->getRootBox ().getNodes ()[rIdx]);
12061197 }
1207- int nNodes = std::min (this ->getNNodes (), this ->getNodeAllocator ().getMaxNodesPerChunk ());
12081198 int ncoefs = this ->getNodeAllocator ().getNCoefs ();
12091199 while (instack.size () > 0 ) {
12101200 // inNode and outNode are the same node in space, but on different trees
@@ -1235,7 +1225,6 @@ template <> void FunctionTree<3, double>::CopyTreeToComplex(FunctionTree<3, Comp
12351225
12361226template <> void FunctionTree<2 , double >::CopyTreeToComplex(FunctionTree<2 , ComplexDouble> *&outTree) {
12371227 delete outTree;
1238- double ref = 0.0 ;
12391228 outTree = new FunctionTree<2 , ComplexDouble>(this ->getMRA ());
12401229 std::vector<MWNode<2 , double > *> instack; // node from this
12411230 std::vector<MWNode<2 , ComplexDouble> *> outstack; // node from outTree
@@ -1244,7 +1233,6 @@ template <> void FunctionTree<2, double>::CopyTreeToComplex(FunctionTree<2, Comp
12441233 instack.push_back (this ->getRootBox ().getNodes ()[rIdx]);
12451234 outstack.push_back (outTree->getRootBox ().getNodes ()[rIdx]);
12461235 }
1247- int nNodes = std::min (this ->getNNodes (), this ->getNodeAllocator ().getMaxNodesPerChunk ());
12481236 int ncoefs = this ->getNodeAllocator ().getNCoefs ();
12491237 while (instack.size () > 0 ) {
12501238 // inNode and outNode are the same node in space, but on different trees
@@ -1275,7 +1263,6 @@ template <> void FunctionTree<2, double>::CopyTreeToComplex(FunctionTree<2, Comp
12751263
12761264template <> void FunctionTree<1 , double >::CopyTreeToComplex(FunctionTree<1 , ComplexDouble> *&outTree) {
12771265 delete outTree;
1278- double ref = 0.0 ;
12791266 outTree = new FunctionTree<1 , ComplexDouble>(this ->getMRA ());
12801267 std::vector<MWNode<1 , double > *> instack; // node from this
12811268 std::vector<MWNode<1 , ComplexDouble> *> outstack; // node from outTree
@@ -1284,7 +1271,6 @@ template <> void FunctionTree<1, double>::CopyTreeToComplex(FunctionTree<1, Comp
12841271 instack.push_back (this ->getRootBox ().getNodes ()[rIdx]);
12851272 outstack.push_back (outTree->getRootBox ().getNodes ()[rIdx]);
12861273 }
1287- int nNodes = std::min (this ->getNNodes (), this ->getNodeAllocator ().getMaxNodesPerChunk ());
12881274 int ncoefs = this ->getNodeAllocator ().getNCoefs ();
12891275 while (instack.size () > 0 ) {
12901276 // inNode and outNode are the same node in space, but on different trees
@@ -1316,7 +1302,6 @@ template <> void FunctionTree<1, double>::CopyTreeToComplex(FunctionTree<1, Comp
13161302// for testing
13171303template <> void FunctionTree<3 , double >::CopyTreeToReal(FunctionTree<3 , double > *&outTree) {
13181304 delete outTree;
1319- double ref = 0.0 ;
13201305 // FunctionTree<3, double>* inTree = this;
13211306 outTree = new FunctionTree<3 , double >(this ->getMRA ());
13221307 std::vector<MWNode<3 , double > *> instack; // node from this
@@ -1326,7 +1311,6 @@ template <> void FunctionTree<3, double>::CopyTreeToReal(FunctionTree<3, double>
13261311 instack.push_back (this ->getRootBox ().getNodes ()[rIdx]);
13271312 outstack.push_back (outTree->getRootBox ().getNodes ()[rIdx]);
13281313 }
1329- int nNodes = std::min (this ->getNNodes (), this ->getNodeAllocator ().getMaxNodesPerChunk ());
13301314 int ncoefs = this ->getNodeAllocator ().getNCoefs ();
13311315 while (instack.size () > 0 ) {
13321316 // inNode and outNode are the same node in space, but on different trees
0 commit comments