Whitespace changes

Whitespace changes

--- CPython/binarytree/binarytree.cpp
+++ CPython/binarytree/binarytree.cpp
@@ -48,52 +48,52 @@
     return list;
 }

-static PyMethodDef  BinaryTree_methods[] = {
+static PyMethodDef BinaryTree_methods[] = {
     {"add", (PyCFunction) BinaryTree_add, METH_VARARGS, "Add an element to the BinaryTree"},
     {"walk", (PyCFunction) BinaryTree_walk, METH_NOARGS, "Walk the tree and return a list"},
-    {NULL}  /* Sentinel */
+    {NULL} /* Sentinel */
 };

 static PyTypeObject BinaryTreeType = {
     PyObject_HEAD_INIT(NULL)
-    0,                                    /* ob_size is not used anymore, docs don't explain *what* it is */
-    "binarytree.BinaryTree",              /* tp_name, string for object */
-    sizeof(BinaryTree_obj),               /* tp_basicsize, how much space to alloc */
-    0,                                    /* tp_itemsize */
-    (destructor) BinaryTree_dealloc,      /* tp_dealloc */
-    0,                                    /* tp_print */
-    0,                                    /* tp_getattr */
-    0,                                    /* tp_setattr */
-    0,                                    /* tp_compare */
-    0,                                    /* tp_repr */
-    0,                                    /* tp_as_number */
-    0,                                    /* tp_as_sequence */
-    0,                                    /* tp_as_mapping */
-    0,                                    /* tp_hash */
-    0,                                    /* tp_call */
-    BinaryTree_ToString,                  /* tp_str */
-    0,                                    /* tp_getattro */
-    0,                                    /* tp_setattro */
-    0,                                    /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                   /* tp_flags */
-    "BinaryTree object",                  /* class docstring */
-    0,		                          /* tp_traverse */
-    0,		                          /* tp_clear */
-    0,		                          /* tp_richcompare */
-    0,		                          /* tp_weaklistoffset */
-    0,		                          /* tp_iter */
-    0,		                          /* tp_iternext */
-    BinaryTree_methods,                   /* tp_methods */
-    0,                                    /* tp_members */
-    0,                                    /* tp_getset */
-    0,                                    /* tp_base */
-    0,                                    /* tp_dict */
-    0,                                    /* tp_descr_get */
-    0,                                    /* tp_descr_set */
-    0,                                    /* tp_dictoffset */
-    (initproc) BinaryTree_init,           /* tp_init */
-    0,                                    /* tp_alloc */
-    0,                                    /* tp_new */
+    0,                                 /* ob_size is not used anymore, docs don't explain *what* it is */
+    "binarytree.BinaryTree",           /* tp_name, string for object */
+    sizeof(BinaryTree_obj),            /* tp_basicsize, how much space to alloc */
+    0,                                 /* tp_itemsize */
+    (destructor) BinaryTree_dealloc,   /* tp_dealloc */
+    0,                                 /* tp_print */
+    0,                                 /* tp_getattr */
+    0,                                 /* tp_setattr */
+    0,                                 /* tp_compare */
+    0,                                 /* tp_repr */
+    0,                                 /* tp_as_number */
+    0,                                 /* tp_as_sequence */
+    0,                                 /* tp_as_mapping */
+    0,                                 /* tp_hash */
+    0,                                 /* tp_call */
+    BinaryTree_ToString,               /* tp_str */
+    0,                                 /* tp_getattro */
+    0,                                 /* tp_setattro */
+    0,                                 /* tp_as_buffer  */
+    Py_TPFLAGS_DEFAULT,                /* tp_flags  */
+    "BinaryTree  object",              /* tp_doc */
+    0,		                       /* tp_traverse  */
+    0,		                       /* tp_clear  */
+    0,		                       /* tp_richcompare  */
+    0,		                       /* tp_weaklistoffset  */
+    0,		                       /* tp_iter  */
+    0,		                       /* tp_iternext  */
+    BinaryTree_methods,                /* tp_methods  */
+    0,                                 /* tp_members  */
+    0,                                 /* tp_getset  */
+    0,                                 /* tp_base  */
+    0,                                 /* tp_dict  */
+    0,                                 /* tp_descr_get  */
+    0,                                 /* tp_descr_set  */
+    0,                                 /* tp_dictoffset  */
+    (initproc)  BinaryTree_init,       /* tp_init  */
+    0,                                 /* tp_alloc  */
+    0,                                 /* tp_new  */
 };

 static PyMethodDef binarytree_funcs[] = {
@@ -109,6 +109,5 @@
     PyObject* m;
     m = Py_InitModule3("binarytree", binarytree_funcs, "Binary Tree wrapper module over a C++11 lib.");
     Py_INCREF(&BinaryTreeType);
-
     PyModule_AddObject(m, "BinaryTree", (PyObject *) &BinaryTreeType);
 }


Remove all but one place in this file where we return
ERR_FAILED.

In the remaining place, log the original Win32 error
code to help diagnose a failure in the field.

R=darin
Review URL: http://codereview.chromium.org/1927

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@2066 0039d316-1c4b-4281-b951-d872f2087c98

--- net/base/tcp_client_socket.cc
+++ net/base/tcp_client_socket.cc
@@ -45,6 +45,7 @@
     case ERROR_SUCCESS:
       return OK;
     default:
+      LOG(WARNING) << "Unknown error " << err << " mapped to net::ERR_FAILED";
       return ERR_FAILED;
   }
 }
@@ -102,7 +103,7 @@

 int TCPClientSocket::ReconnectIgnoringLastError(CompletionCallback* callback) {
   // No ignorable errors!
-  return ERR_FAILED;
+  return ERR_UNEXPECTED;
 }

 void TCPClientSocket::Disconnect() {
@@ -258,7 +259,7 @@
     }
   } else {
     NOTREACHED();
-    result = ERR_FAILED;
+    result = ERR_UNEXPECTED;
   }

   if (result != ERR_IO_PENDING)


add unistd.h include needed for read()/write() and gcc 4.7. Fixes issue
94702.

git-svn-id: 9d02132d8e1217b86764d694e1605987040d84e5@44287 27541ba8-7e3a-0410-8455-c3a389f83636

--- net/krb5auth/src/TKSocket.cxx
+++ net/krb5auth/src/TKSocket.cxx
@@ -5,6 +5,9 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <netinet/in.h>
+#ifndef WIN32
+#   include <unistd.h>
+#endif

 #include "TKSocket.h"
 #include "TSocket.h"


Implement the delay setter for the Delay effect

--- ouzel/audio/Effects.cpp
+++ ouzel/audio/Effects.cpp
@@ -47,6 +47,11 @@
                 }
             }

+            void setDelay(float newDelay)
+            {
+                delay = newDelay;
+            }
+
         private:
             float delay = 0.0F;
             std::vector<float> buffer;
@@ -66,6 +71,11 @@
         void Delay::setDelay(float newDelay)
         {
             delay = newDelay;
+
+            audio.updateProcessor(processorId, [newDelay](mixer::Object* node) {
+                DelayProcessor* delayProcessor = static_cast<DelayProcessor*>(node);
+                delayProcessor->setDelay(newDelay);
+            });
         }

         class GainProcessor final: public mixer::Processor


missing T

missing T

--- vdf_parser.hpp
+++ vdf_parser.hpp
@@ -129,7 +129,7 @@
         Uses tabs instead of whitespaces.
         */
         template<typename oStreamT, typename charT = typename oStreamT::char_type>
-        void write(oStreamT& s, const basic_object<charT>& r, size_t t = 0) noexcept(noexcept(std::operator<<(oStream&, const charT*)))
+        void write(oStreamT& s, const basic_object<charT>& r, size_t t = 0) noexcept(noexcept(std::operator<<(oStreamT&, const charT*)))
         {
             using namespace detail;
             s << tabs(t) << TYTI_L(charT, '"') << r.name << TYTI_L(charT, "\"\n") << tabs(t) << TYTI_L(charT, "{\n");


[ownership] Fix build due to a missing code change dependency in between two PRs.

--- lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp
+++ lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp
@@ -11,12 +11,14 @@
 //===----------------------------------------------------------------------===//

 #define DEBUG_TYPE "sil-combine"
+
 #include "SILCombiner.h"
+
 #include "swift/AST/GenericSignature.h"
 #include "swift/AST/Module.h"
+#include "swift/AST/SemanticAttrs.h"
 #include "swift/AST/SubstitutionMap.h"
 #include "swift/Basic/Range.h"
-#include "swift/AST/SemanticAttrs.h"
 #include "swift/SIL/DebugUtils.h"
 #include "swift/SIL/DynamicCasts.h"
 #include "swift/SIL/InstructionUtils.h"
@@ -29,6 +31,7 @@
 #include "swift/SILOptimizer/Utils/CFGOptUtils.h"
 #include "swift/SILOptimizer/Utils/Existential.h"
 #include "swift/SILOptimizer/Utils/KeyPathProjector.h"
+#include "swift/SILOptimizer/Utils/OwnershipOptUtils.h"
 #include "swift/SILOptimizer/Utils/ValueLifetime.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -1510,11 +1513,10 @@
     // First perform an ownership RAUW+erase of arg0 and inverse apply. The OSSA
     // RAUW helper will copy arg0 if needed. We need to do this before anything
     // else since the utility assumes OSSA is in correct form.
-    if (!decltype(ownershipRAUWHelper)::canFixUpOwnershipForRAUW(fInverseApply,
-                                                                 arg0)) {
+    OwnershipRAUWHelper helper(ownershipFixupContext, fInverseApply, arg0);
+    if (!helper)
       return false;
-    }
-    ownershipRAUWHelper.replaceAllUsesAndErase(fInverseApply, arg0);
+    helper.perform();

     // Now remove the apply, inserting a destroy_value if we need to it arg0.
     if (fApply->getArgumentRef(0).isLifetimeEnding()) {


Added functionality to instrmentation pass

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@7161 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
+++ lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
@@ -5,6 +5,7 @@
 //===----------------------------------------------------------------------===//

 #include "llvm/Reoptimizer/InstLoops.h"
+#include "llvm/Analysis/Dominators.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Constants.h"
 #include "llvm/iMemory.h"
@@ -27,11 +28,26 @@
   BLACK
 };

-struct InstLoops : public FunctionPass {
-  bool runOnFunction(Function &F);
-};
-
-static RegisterOpt<InstLoops> X("instloops", "Instrument backedges for profiling");
+namespace{
+  struct InstLoops : public FunctionPass {
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired<DominatorSet>();
+    }
+  private:
+    DominatorSet *DS;
+    void getBackEdgesVisit(BasicBlock *u,
+			   std::map<BasicBlock *, Color > &color,
+			   std::map<BasicBlock *, int > &d,
+			   int &time, Value *threshold,
+			   std::map<BasicBlock *, BasicBlock *> &be);
+    void removeRedundant(std::map<BasicBlock *, BasicBlock *> &be);
+    void getBackEdges(Function &F, Value *threshold);
+  public:
+    bool runOnFunction(Function &F);
+  };
+
+    RegisterOpt<InstLoops> X("instloops", "Instrument backedges for profiling");
+}

 // createInstLoopsPass - Create a new pass to add path profiling
 //
@@ -42,10 +58,11 @@

 //helper function to get back edges: it is called by
 //the "getBackEdges" function below
-void getBackEdgesVisit(BasicBlock *u,
+void InstLoops::getBackEdgesVisit(BasicBlock *u,
                        std::map<BasicBlock *, Color > &color,
                        std::map<BasicBlock *, int > &d,
-                       int &time, Value *threshold) {
+                       int &time, Value *threshold,
+		       std::map<BasicBlock *, BasicBlock *> &be) {

   color[u]=GREY;
   time++;
@@ -57,98 +74,44 @@
     BasicBlock *BB = *vl;

     if(color[BB]!=GREY && color[BB]!=BLACK){
-      getBackEdgesVisit(BB, color, d, time, threshold);
+      getBackEdgesVisit(BB, color, d, time, threshold, be);
     }

     //now checking for d and f vals
-    if(color[BB]==GREY){
+    else if(color[BB]==GREY){
       //so v is ancestor of u if time of u > time of v
       if(d[u] >= d[BB]){
-        //insert a new basic block: modify terminator accordingly!
-        BasicBlock *newBB = new BasicBlock("", u->getParent());
-        BranchInst *ti = cast<BranchInst>(u->getTerminator());
-        unsigned char index = 1;
-        if(ti->getSuccessor(0) == BB){
-          index = 0;
-        }
-        assert(ti->getNumSuccessors() > index && "Not enough successors!");
-        ti->setSuccessor(index, newBB);
-
-        //insert global variable of type int
-        Constant *initializer = Constant::getNullValue(Type::IntTy);
-        GlobalVariable *countVar = new GlobalVariable(Type::IntTy, false, true,
-                                                      initializer,
-                                                      "loopCounter",
-                                                      u->getParent()->getParent());
-
-        //load the variable
-        Instruction *ldInst = new LoadInst(countVar,"");
-
-        //increment
-        Instruction *addIn =
-          BinaryOperator::create(Instruction::Add, ldInst,
-                                 ConstantSInt::get(Type::IntTy,1), "");
-
-        //store
-        Instruction *stInst = new StoreInst(addIn, countVar);
-
-
-        Instruction *etr = new LoadInst(threshold, "threshold");
-        Instruction *cmpInst = new SetCondInst(Instruction::SetLE, etr,
-                                               addIn, "");
-
-        BasicBlock *callTrigger = new BasicBlock("", u->getParent());
-        //branch to calltrigger, or *vl
-        Instruction *newBr = new BranchInst(callTrigger, BB, cmpInst);
-
-        BasicBlock::InstListType &lt = newBB->getInstList();
-
-        lt.push_back(ldInst);
-        lt.push_back(addIn);
-        lt.push_back(stInst);
-        lt.push_back(etr);
-        lt.push_back(cmpInst);
-        lt.push_back(newBr);
-
-        //Now add instructions to the triggerCall BB
-        //now create a call function
-        //call llvm_first_trigger(int *x);
-        std::vector<const Type*> inCountArgs;
-        inCountArgs.push_back(PointerType::get(Type::IntTy));
-
-        const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
-                                                     false);
-        Function *inCountMth =
-          u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger", cFty);
-
-        assert(inCountMth && "Initialize method could not be inserted!");
-
-        std::vector<Value *> iniArgs;
-        iniArgs.push_back(countVar);
-        Instruction *call = new CallInst(inCountMth, iniArgs, "");
-        callTrigger->getInstList().push_back(call);
-        callTrigger->getInstList().push_back(new BranchInst(BB));
-
-        //now iterate over *vl, and set its Phi nodes right
-        for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
-            BB2Inst != BBend; ++BB2Inst){
-
-          if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
-            int bbIndex = phiInst->getBasicBlockIndex(u);
-            if(bbIndex>=0){
-              phiInst->setIncomingBlock(bbIndex, newBB);
-
-              Value *val = phiInst->getIncomingValue((unsigned int)bbIndex);
-              phiInst->addIncoming(val, callTrigger);
-            }
-          }
-        }
+	//u->BB is a backedge
+	be[u] = BB;
       }
     }
   }
   color[u]=BLACK;//done with visiting the node and its neighbors
 }

+//look at all BEs, and remove all BEs that are dominated by other BE's in the
+//set
+void InstLoops::removeRedundant(std::map<BasicBlock *, BasicBlock *> &be){
+  std::vector<BasicBlock *> toDelete;
+  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
+	ME = be.end(); MI != ME; ++MI){
+    //std::cerr<<MI->first->getName()<<"\t->\t"<<MI->second->getName()<<"\n";
+    //std::cerr<<MI->first;
+    //std::cerr<<MI->second;
+    for(std::map<BasicBlock *, BasicBlock *>::iterator MMI = be.begin(),
+	  MME = be.end(); MMI != MME; ++MMI){
+      if(DS->properlyDominates(MI->first, MMI->first)){
+	toDelete.push_back(MMI->first);
+	//std::cerr<<MI->first->getName()<<"\t Dominates\t"<<MMI->first->getName();
+      }
+    }
+  }
+
+  for(std::vector<BasicBlock *>::iterator VI = toDelete.begin(),
+	VE = toDelete.end(); VI != VE; ++VI){
+    be.erase(*VI);
+  }
+}

 //getting the backedges in a graph
 //Its a variation of DFS to get the backedges in the graph
@@ -161,11 +124,57 @@
 //have been visited
 //So we have a back edge when we meet a successor of
 //a node with smaller time, and GREY color
-void getBackEdges(Function &F, Value *threshold){
+void InstLoops::getBackEdges(Function &F, Value *threshold){
   std::map<BasicBlock *, Color > color;
   std::map<BasicBlock *, int> d;
+  std::map<BasicBlock *, BasicBlock *> be;
   int time=0;
-  getBackEdgesVisit(F.begin(), color, d, time, threshold);
+  getBackEdgesVisit(F.begin(), color, d, time, threshold, be);
+
+  removeRedundant(be);
+
+  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
+	ME = be.end(); MI != ME; ++MI){
+    BasicBlock *u = MI->first;
+    BasicBlock *BB = MI->second;
+    //std::cerr<<"Edge from: "<<BB->getName()<<"->"<<u->getName()<<"\n";
+    //insert a new basic block: modify terminator accordingly!
+    BasicBlock *newBB = new BasicBlock("", u->getParent());
+    BranchInst *ti = cast<BranchInst>(u->getTerminator());
+    unsigned char index = 1;
+    if(ti->getSuccessor(0) == BB){
+      index = 0;
+    }
+    assert(ti->getNumSuccessors() > index && "Not enough successors!");
+    ti->setSuccessor(index, newBB);
+
+    BasicBlock::InstListType &lt = newBB->getInstList();
+
+    std::vector<const Type*> inCountArgs;
+    const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
+						 false);
+    Function *inCountMth =
+      u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
+						       cFty);
+
+    assert(inCountMth && "Initial method could not be inserted!");
+
+    Instruction *call = new CallInst(inCountMth, "");
+    lt.push_back(call);
+    lt.push_back(new BranchInst(BB));
+
+    //now iterate over *vl, and set its Phi nodes right
+    for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
+	BB2Inst != BBend; ++BB2Inst){
+
+      if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
+	int bbIndex = phiInst->getBasicBlockIndex(u);
+	if(bbIndex>=0){
+	  phiInst->setIncomingBlock(bbIndex, newBB);
+	}
+      }
+    }
+  }
 }

 //Per function pass for inserting counters and call function
@@ -173,11 +182,18 @@

   static GlobalVariable *threshold = NULL;
   static bool insertedThreshold = false;
-
-   if(!insertedThreshold){
-    threshold = new GlobalVariable(Type::IntTy, false, false, 0,
-                                                   "reopt_threshold");
-
+
+  DS  = &getAnalysis<DominatorSet>();
+
+  if(F.isExternal()) {
+    return false;
+  }
+
+  if(!insertedThreshold){
+    threshold = new GlobalVariable(Type::IntTy, false,
+				   GlobalValue::ExternalLinkage, 0,
+                                   "reopt_threshold");
+
     F.getParent()->getGlobalList().push_back(threshold);
     insertedThreshold = true;
   }
@@ -199,11 +215,7 @@
   }

   assert(threshold && "GlobalVariable threshold not defined!");
-
-  if(F.isExternal()) {
-    return false;
-  }
-
+
   getBackEdges(F, threshold);

   return true;


Fixed bad interface (SetCursor/SetIndex) and underlying ivars

Change-Id: I915168b5f1241af0588be25e68649c813fd06d8a

--- Common/DataModel/vtkHyperTree.cxx
+++ Common/DataModel/vtkHyperTree.cxx
@@ -62,7 +62,7 @@
   int GetLeafId()
   {
     assert( "pre: is_leaf" && CurrentIsLeaf() );
-    return this->Cursor;
+    return this->Index;
   }

   // Status
@@ -73,7 +73,7 @@

   virtual int CurrentIsRoot()
   {
-    return ( this->IsLeaf && ! this->Cursor && this->Tree->GetLeafParentSize()==1 ) || (!this->IsLeaf && this->Cursor==1);
+    return ( this->IsLeaf && ! this->Index && this->Tree->GetLeafParentSize()==1 ) || (!this->IsLeaf && this->Index==1);
   }

   //---------------------------------------------------------------------------
@@ -107,7 +107,7 @@
     int result = !this->IsLeaf;
     if(result)
       {
-      vtkCompactHyperTreeNode<N> *node=this->Tree->GetNode( this->Cursor);
+      vtkCompactHyperTreeNode<N> *node=this->Tree->GetNode( this->Index);
       result = node->IsTerminalNode();
       }
     // A=>B: notA or B
@@ -125,17 +125,17 @@
     this->IsLeaf = ( this->Tree->GetLeafParentSize() == 1 );
     if ( this->IsLeaf )
       {
-      this->Cursor = 0;
+      this->Index = 0;
       }
     else
       {
-      this->Cursor = 1;
+      this->Index = 1;
       }
     this->ChildIndex = 0;

     for ( unsigned int i = 0; i < this->Dimension; ++ i )
       {
-      this->Index[i] = 0;
+      this->Indices[i] = 0;
       }
   }

@@ -146,11 +146,11 @@
     assert( "pre: not_root" && !CurrentIsRoot() );
     if( this->IsLeaf)
       {
-      this->Cursor=this->Tree->GetLeafParent( this->Cursor);
+      this->Index = this->Tree->GetLeafParent( this->Index);
       }
     else
       {
-      this->Cursor=this->Tree->GetNode( this->Cursor)->GetParent();
+      this->Index = this->Tree->GetNode( this->Index)->GetParent();
       }
     this->IsLeaf = 0;
     this->ChildIndex=this->ChildHistory.back(); // top()
@@ -158,7 +158,7 @@

     for ( unsigned int i = 0; i < this->Dimension;  ++ i )
       {
-      this->Index[i]=( this->Index[i] ) / this->Tree->GetBranchFactor();
+      this->Indices[i]=( this->Indices[i] ) / this->Tree->GetBranchFactor();
       }
   }

@@ -170,10 +170,10 @@
     assert( "pre: not_leaf" && !CurrentIsLeaf() );
     assert( "pre: valid_child" && child >= 0 && child<this->GetNumberOfChildren() );

-    vtkCompactHyperTreeNode<N> *node=this->Tree->GetNode( this->Cursor);
+    vtkCompactHyperTreeNode<N> *node=this->Tree->GetNode( this->Index);
     this->ChildHistory.push_back( this->ChildIndex );
     this->ChildIndex=child;
-    this->Cursor=node->GetChild( child );
+    this->Index=node->GetChild( child );
     this->IsLeaf=node->IsChildLeaf( child );

     int tmpChild = child;
@@ -186,7 +186,7 @@
       tmpChild /= branchFactor;
       int index=tmp-(branchFactor*tmpChild); // Remainder (mod)
       assert( "check: mod 3 value" && index >= 0 && index<branchFactor);
-      this->Index[i]=(( this->Index[i])*branchFactor)+index;
+      this->Indices[i]=(( this->Indices[i])*branchFactor)+index;
       }
   }

@@ -203,14 +203,14 @@

     vtkCompactHyperTreeCursor<N> *o = static_cast<vtkCompactHyperTreeCursor<N> *>( other );

-    this->Cursor=o->Cursor;
-    this->ChildIndex=o->ChildIndex;
-    this->IsLeaf=o->IsLeaf;
-    this->ChildHistory=o->ChildHistory; // use assignment operator
+    this->Index = o->Index;
+    this->ChildIndex = o->ChildIndex;
+    this->IsLeaf = o->IsLeaf;
+    this->ChildHistory = o->ChildHistory; // use assignment operator

     for( unsigned int i = 0; i < this->Dimension; ++ i )
       {
-      this->Index[i] = o->Index[i];
+      this->Indices[i] = o->Indices[i];
       }
     assert( "post: equal" && this->IsEqual(other) );
   }
@@ -227,12 +227,12 @@

     vtkCompactHyperTreeCursor<N> *o=static_cast<vtkCompactHyperTreeCursor<N> *>(other);

-    int result = this->Cursor==o->Cursor && this->ChildIndex==o->ChildIndex
+    int result = this->Index==o->Index && this->ChildIndex==o->ChildIndex
       && this->IsLeaf==o->IsLeaf && this->ChildHistory==o->ChildHistory;

     for( unsigned int i = 0; result && i < this->Dimension; ++ i )
       {
-      result = this->Index[i] == o->Index[i];
+      result = this->Indices[i] == o->Indices[i];
       ++ i;
       }
     return result;
@@ -277,7 +277,7 @@
   virtual int GetIndex(int d)
   {
     assert( "pre: valid_range" &&  d >= 0 && d<this->Dimension );
-    int result = this->Index[d];
+    int result = this->Indices[d];
     return result;
   }

@@ -383,10 +383,10 @@
   //---------------------------------------------------------------------------
   // Description:
   // Public only for vtkCompactHyperTree.
-  void SetCursor(int cursor)
-  {
-    assert( "pre: positive_cursor" && cursor >= 0 );
-    this->Cursor=cursor;
+  void SetIndex( int index )
+  {
+    assert( "pre: positive_index" && index >= 0 );
+    this->Index = index;
   }

   //---------------------------------------------------------------------------
@@ -426,29 +426,35 @@
         assert( "Bad number of children" && this->Dimension == 0 );
       }
     this->Tree = 0;
-    this->Cursor = 0;
+    this->Index = 0;
     this->IsLeaf = 0;
     this->ChildIndex = 0;

     for ( unsigned int i = 0; i < this->Dimension; ++ i )
       {
-      this->Index[i] = 0;
+      this->Indices[i] = 0;
       }
   }

   vtkCompactHyperTree<N> *Tree;
   unsigned char Dimension;
-  int Cursor; // index either in the Nodes or Parents (if leaf)
-  int ChildIndex; // the current node is child number ChildIndex
-  // (in [0,1<<D-1]) for its parent node (comment specific for oct/quad trees)
+
+  // Index either in the Nodes or Parents (if leaf)
+  int Index;
+
+  // Number of current node as a child
+  int ChildIndex;

   int IsFound;
   int IsLeaf;

-  std::deque<int> ChildHistory; // a stack, but stack does not have clear()
-  // I have to default to three dimensions and not use the third for quad/9 trees
-  int Index[3]; // index in each dimension of the current node, as if the
-  // tree at the current level were a uniform grid.
+  // A stack, but stack does not have clear()
+  std::deque<int> ChildHistory;
+
+  // Index in each dimension of the current node, as if the tree at the current
+  // level were a uniform grid. Default to 3 dimensions, use only those needed
+  int Indices[3];
+
 private:
   vtkCompactHyperTreeCursor(const vtkCompactHyperTreeCursor<N> &);  // Not implemented.
   void operator=(const vtkCompactHyperTreeCursor<N> &);    // Not implemented.
@@ -729,7 +735,7 @@
   // At the end, cursor points on the node that used to be leaf.
   // \pre leaf_exists: leaf != 0
   // \pre is_a_leaf: leaf->CurrentIsLeaf()
-  void SubdivideLeaf(vtkHyperTreeCursor* leafCursor)
+  void SubdivideLeaf( vtkHyperTreeCursor* leafCursor )
   {
     assert( "pre: leaf_exists" && leafCursor != 0 );
     assert( "pre: is_a_leaf" && leafCursor->CurrentIsLeaf() );
@@ -739,12 +745,10 @@
     int leafIndex = leafCursor->GetLeafId();
     vtkCompactHyperTreeCursor<N>* cursor=static_cast<vtkCompactHyperTreeCursor<N> *>(leafCursor);

-    // the leaf becomes a node and is not anymore a leaf.
+    // The leaf becomes a node and is not anymore a leaf.
     cursor->SetIsLeaf( 0 ); // let the cursor knows about that change.
     size_t nodeIndex = this->Nodes.size();
-
-    // NB: Bad interface "SetCursor"; should rather SetIndex.
-    cursor->SetCursor( static_cast<int>( nodeIndex ) );
+    cursor->SetIndex( static_cast<int>( nodeIndex ) );

     // Nodes get constructed with leaf flags set to 1.
     this->Nodes.resize( nodeIndex + 1 );


Fixed some loop variables.

Fixed some loop variables.

--- Common/src/geometry_structure.cpp
+++ Common/src/geometry_structure.cpp
@@ -7709,16 +7709,16 @@
        balancing for any remainder points. ---*/

       total_pt_accounted = 0;
-      for (unsigned long i=0; i<size; i++) {
-        npoint_procs[i] = vertices[j-1]/size;
-        total_pt_accounted = total_pt_accounted + npoint_procs[i];
+      for (int ii = 0; ii < size; ii++) {
+        npoint_procs[ii] = vertices[j-1]/size;
+        total_pt_accounted = total_pt_accounted + npoint_procs[ii];
       }

       /*--- Get the number of remainder points after the even division ---*/

       rem_points = vertices[j-1]-total_pt_accounted;
-      for (unsigned long i=0; i<rem_points; i++) {
-        npoint_procs[i]++;
+      for (int ii = 0; ii < rem_points; ii++) {
+        npoint_procs[ii]++;
       }

       /*--- Store the local number of nodes and the beginning/end index ---*/
@@ -7727,10 +7727,10 @@
       starting_node[0] = 0;
       ending_node[0]   = starting_node[0] + npoint_procs[0];
       nPoint_Linear[0] = 0;
-      for(unsigned long i = 1; i < size; i++) {
-        starting_node[i] = ending_node[i-1];
-        ending_node[i]   = starting_node[i] + npoint_procs[i];
-        nPoint_Linear[i] = nPoint_Linear[i-1] + npoint_procs[i];
+      for(int ii = 1; ii < size; ii++) {
+        starting_node[ii] = ending_node[ii-1];
+        ending_node[ii]   = starting_node[ii] + npoint_procs[ii];
+        nPoint_Linear[ii] = nPoint_Linear[ii-1] + npoint_procs[ii];
       }
       nPoint_Linear[size] = vertices[j-1];

@@ -7850,16 +7850,16 @@

         element_count = (int) (endE-startE+1);
         total_elems = 0;
-        for (unsigned long i=0; i<size; i++) {
-          nElem_Linear[i] = element_count/size;
-          total_elems += nElem_Linear[i];
+        for (int ii = 0; ii < size; ii++) {
+          nElem_Linear[ii] = element_count/size;
+          total_elems += nElem_Linear[ii];
         }

         /*--- Get the number of remainder elements after even division ---*/

         element_remainder = element_count-total_elems;
-        for (unsigned long i=0; i<element_remainder; i++) {
-          nElem_Linear[i]++;
+        for (int ii = 0; ii < element_remainder; ii++) {
+          nElem_Linear[ii]++;
         }

         /*--- Store the number of elements that this rank is responsible for
@@ -7871,10 +7871,16 @@

         elemB[0] = startE;
         elemE[0] = startE + nElem_Linear[0] - 1;
-        for(unsigned long i = 1; i < size; i++) {
-          elemB[i] = elemE[i-1]+1;
-          elemE[i] = elemB[i] + nElem_Linear[i] - 1;
-        }
+        for(unsigned long ii = 1; ii < size; ii++) {
+          elemB[ii] = elemE[ii-1]+1;
+          elemE[ii] = elemB[ii] + nElem_Linear[ii] - 1;
+        }
+
+//        if (rank ==MASTER_NODE) {
+//          cout << " %%%%%%%%%%%%% ";
+//        for(unsigned long ii = 0; ii < size; ii++) cout << elemB[ii] << "  "<< elemE[ii] << "  ";
+//        cout << endl;
+//        }

         /*--- Allocate some memory for the handling the connectivity
          and auxiliary data that we are need to communicate. ---*/
@@ -8048,7 +8054,7 @@
          section together), the master node read the boundary section.
          Otherwise, we have all ranks read and communicate the internals. ---*/

-        if (isInternal[j-1][s-1] == false) {
+        if (!isInternal[j-1][s-1]) {

           /*--- Master node should read this entire marker section. Free
            the memory for the conn. from the CGNS file since we are going
@@ -8086,7 +8092,7 @@
             /*--- Find the number of nodes required to represent
              this type of element. ---*/

-            if ( cg_npe(elemType, &npe) ) cg_error_exit();
+            if (cg_npe(elemType, &npe)) cg_error_exit();
             elemIndex[j-1][s-1] = npe;

             /*--- Need to check the element type and correctly
@@ -8198,7 +8204,8 @@
               }
             }
             delete[] connElemTemp;
-          }
+
+          } // end master

         } else {

@@ -8390,8 +8397,8 @@
           unsigned long iMessage = 0;
           for(int ii=0; ii<size; ii++) {
             if((ii != rank) && (nElem_Recv[ii+1] > nElem_Recv[ii])) {
-              int ll = connSize*nElem_Recv[ii];
-              int kk = nElem_Recv[ii+1] - nElem_Recv[ii];
+              int ll     = connSize*nElem_Recv[ii];
+              int kk     = nElem_Recv[ii+1] - nElem_Recv[ii];
               int count  = connSize*kk;
               int source = ii;
               int tag    = ii + 1;
@@ -8567,12 +8574,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_TRIANGLE+1][i];
-              for(unsigned short i=0;i<N_POINTS_TRIANGLE;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_TRIANGLE;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_TRIANGLE;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8585,12 +8592,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_QUADRILATERAL+1][i];
-              for(unsigned short i=0;i<N_POINTS_QUADRILATERAL;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_QUADRILATERAL;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_QUADRILATERAL;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8604,12 +8611,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_TETRAHEDRON+1][i];
-              for(unsigned short i=0;i<N_POINTS_TETRAHEDRON;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_TETRAHEDRON;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_TETRAHEDRON;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8622,12 +8629,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_HEXAHEDRON+1][i];
-              for(unsigned short i=0;i<N_POINTS_HEXAHEDRON;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_HEXAHEDRON;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_HEXAHEDRON;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8641,12 +8648,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_WEDGE+1][i];
-              for(unsigned short i=0;i<N_POINTS_WEDGE;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_WEDGE;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_WEDGE;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8660,12 +8667,12 @@
                 vnodes_cgns[j] = connElems[k][s][j+1][i];
               }
               global_id = connElems[k][s][N_POINTS_PYRAMID+1][i];
-              for(unsigned short i=0;i<N_POINTS_PYRAMID;i++) {
-                if ((vnodes_cgns[i]>=starting_node[rank])&&(vnodes_cgns[i]<ending_node[rank])){
+              for(unsigned short ii=0;ii<N_POINTS_PYRAMID;ii++) {
+                if ((vnodes_cgns[ii]>=starting_node[rank])&&(vnodes_cgns[ii]<ending_node[rank])){
                   for(unsigned short j=0;j<N_POINTS_PYRAMID;j++) {
-                    if(i!=j){
-                      adjacent_elem[vnodes_cgns[i]-starting_node[rank]][adj_counter[vnodes_cgns[i]-starting_node[rank]]]=vnodes_cgns[j];
-                      adj_counter[vnodes_cgns[i]-starting_node[rank]]++;
+                    if(ii!=j){
+                      adjacent_elem[vnodes_cgns[ii]-starting_node[rank]][adj_counter[vnodes_cgns[ii]-starting_node[rank]]]=vnodes_cgns[j];
+                      adj_counter[vnodes_cgns[ii]-starting_node[rank]]++;
                     }
                   }
                 }
@@ -8793,6 +8800,7 @@
       for ( int j = 0; j < cell_dim; j++ ) Coord_cgns[j] = gridCoords[k][j][i];
       switch(nDim) {
         case 2:
+          //cout << "  " << Coord_cgns[0] << "   " << Coord_cgns[1] << "  " << GlobalIndex << endl;
           node[iPoint] = new CPoint(Coord_cgns[0], Coord_cgns[1], GlobalIndex, config);
           iPoint++; break;
         case 3:
@@ -8908,6 +8916,7 @@
                     MPI_Finalize();
 #endif
                   }
+                  cout << ielem << "  " << vnodes_cgns[0] << "  " << vnodes_cgns[1] << endl;
                   bound[iMarker][ielem] = new CLine(vnodes_cgns[0],vnodes_cgns[1],2);
                   ielem++; nelem_edge_bound++; break;
                 case TRIANGLE:


Apply clang-format to libcaf_python main.cpp

--- libcaf_python/src/main.cpp
+++ libcaf_python/src/main.cpp
@@ -18,12 +18,12 @@

 #include "caf/config.hpp"

-#include <set>
 #include <chrono>
-#include <thread>
+#include <functional>
 #include <iomanip>
 #include <iostream>
-#include <functional>
+#include <set>
+#include <thread>
 #include <unordered_map>

 CAF_PUSH_WARNINGS
@@ -33,8 +33,8 @@
 #include "caf/all.hpp"
 #include "caf/io/all.hpp"

+using std::cerr;
 using std::cout;
-using std::cerr;
 using std::endl;

 namespace {
@@ -91,19 +91,14 @@

 namespace caf {

-void register_class(atom_value*, pybind11::module& m,
-                    const std::string& name) {
-  auto repr_fun = [](atom_value x) {
-    return "atom('" + to_string(x) + "')";
-  };
-  auto cmp = [](atom_value x, atom_value y) {
-    return x == y;
-  };
+void register_class(atom_value*, pybind11::module& m, const std::string& name) {
+  auto repr_fun = [](atom_value x) { return "atom('" + to_string(x) + "')"; };
+  auto cmp = [](atom_value x, atom_value y) { return x == y; };
   std::string (*to_string_fun)(atom_value) = &to_string;
   pybind11::class_<atom_value>(m, name.c_str())
-  .def("__str__", to_string_fun)
-  .def("__repr__", repr_fun)
-  .def("__eq__", cmp);
+    .def("__str__", to_string_fun)
+    .def("__repr__", repr_fun)
+    .def("__eq__", cmp);
 }

 namespace python {
@@ -112,13 +107,12 @@
 class binding {
 public:
   binding(std::string py_name, bool builtin_type)
-      : python_name_(std::move(py_name)),
-        builtin_(builtin_type) {
+    : python_name_(std::move(py_name)), builtin_(builtin_type) {
     // nop
   }

   virtual ~binding() {
-    //nop
+    // nop
   }

   inline void docstring(std::string x) {
@@ -201,13 +195,14 @@
 class has_register_class {
 private:
   template <class U>
-  static auto test(U* x) -> decltype(register_class(x,
-                                                    std::declval<pybind11::module&>(),
-                                                    std::declval<const std::string&>()));
+  static auto test(U* x)
+    -> decltype(register_class(x, std::declval<pybind11::module&>(),
+                               std::declval<const std::string&>()));

   static auto test(...) -> std::false_type;

   using type = decltype(test(static_cast<T*>(nullptr)));
+
 public:
   static constexpr bool value = std::is_same<type, void>::value;
 };
@@ -221,39 +216,29 @@
   static auto test(...) -> void;

   using type = decltype(test(static_cast<T*>(nullptr)));
+
 public:
   static constexpr bool value = std::is_same<type, std::string>::value;
 };

 template <class T>
-typename std::enable_if<
-  !has_register_class<T>::value
-  && has_to_string<T>::value
->::type
+typename std::enable_if<!has_register_class<T>::value
+                        && has_to_string<T>::value>::type
 default_python_class_init(pybind11::module& m, const std::string& name) {
-  auto str_impl = [](const T& x) {
-    return to_string(x);
-  };
-  pybind11::class_<T>(m, name.c_str())
-  .def("__str__", str_impl);
+  auto str_impl = [](const T& x) { return to_string(x); };
+  pybind11::class_<T>(m, name.c_str()).def("__str__", str_impl);
 }

 template <class T>
-typename std::enable_if<
-  !has_register_class<T>::value
-  && !has_to_string<T>::value
->::type
+typename std::enable_if<!has_register_class<T>::value
+                        && !has_to_string<T>::value>::type
 default_python_class_init(pybind11::module& m, const std::string& name) {
-  auto str_impl = [](const T& x) {
-    return to_string(x);
-  };
+  auto str_impl = [](const T& x) { return to_string(x); };
   pybind11::class_<T>(m, name.c_str());
 }

 template <class T>
-typename std::enable_if<
-  has_register_class<T>::value
->::type
+typename std::enable_if<has_register_class<T>::value>::type
 default_python_class_init(pybind11::module& m, const std::string& name) {
   register_class(static_cast<T*>(nullptr), m, name);
 }
@@ -269,7 +254,8 @@

   absolute_receive_timeout() = default;
   absolute_receive_timeout(const absolute_receive_timeout&) = default;
-  absolute_receive_timeout& operator=(const absolute_receive_timeout&) = default;
+  absolute_receive_timeout& operator=(const absolute_receive_timeout&)
+    = default;

   const clock_type::time_point& value() const {
     return x_;
@@ -298,8 +284,8 @@
 void register_class(absolute_receive_timeout*, pybind11::module& m,
                     const std::string& name) {
   pybind11::class_<absolute_receive_timeout>(m, name.c_str())
-  .def(pybind11::init<>())
-  .def(pybind11::init<int>());
+    .def(pybind11::init<>())
+    .def(pybind11::init<int>());
 }

 class py_config : public actor_system_config {
@@ -307,7 +293,8 @@
   std::string pre_run;
   std::string banner = default_banner;

-  using register_fun = std::function<void (pybind11::module&, const std::string&)>;
+  using register_fun = std::function<void(pybind11::module&,
+                                          const std::string&)>;

   py_config() {
     // allow CAF to convert native Python types to C++ types
@@ -359,9 +346,7 @@
     oss << "import IPython" << endl
         << "c = IPython.Config()" << endl
         << "c.InteractiveShellApp.exec_lines = [" << endl
-        << R"(""")"
-        << full_pre_run
-        << R"(""")" << endl
+        << R"(""")" << full_pre_run << R"(""")" << endl
         << "]" << endl
         << "c.PromptManager.in_template  = ' $: '" << endl
         << "c.PromptManager.in2_template = ' -> '" << endl
@@ -374,17 +359,18 @@
     return oss.str();
   }

-   const std::unordered_map<std::string, binding*>& bindings() const {
-     return bindings_;
-   }
-
-   const std::unordered_map<std::string, cpp_binding*>& portable_bindings() const {
-     return portable_bindings_;
-   }
-
-   const std::unordered_map<std::string, cpp_binding_ptr>& cpp_bindings() const {
-     return cpp_bindings_;
-   }
+  const std::unordered_map<std::string, binding*>& bindings() const {
+    return bindings_;
+  }
+
+  const std::unordered_map<std::string, cpp_binding*>&
+  portable_bindings() const {
+    return portable_bindings_;
+  }
+
+  const std::unordered_map<std::string, cpp_binding_ptr>& cpp_bindings() const {
+    return cpp_bindings_;
+  }

 private:
   template <class T>
@@ -417,7 +403,7 @@
   std::unordered_map<std::string, cpp_binding_ptr> cpp_bindings_;
   std::unordered_map<std::string, py_binding_ptr> py_bindings_;

-  std::vector<std::function<void (pybind11::module&)>> register_funs_;
+  std::vector<std::function<void(pybind11::module&)>> register_funs_;
 };
 struct py_context {
   const py_config& cfg;
@@ -439,7 +425,6 @@
 void set_py_exception_fill(std::ostream& oss, T&& x, Ts&&... xs) {
   set_py_exception_fill(oss << std::forward<T>(x), std::forward<Ts>(xs)...);
 }
-

 template <class... Ts>
 void set_py_exception(Ts&&... xs) {
@@ -462,8 +447,8 @@
     std::string type_name = PyEval_GetFuncName((*i).ptr());
     auto kvp = bindings.find(type_name);
     if (kvp == bindings.end()) {
-      set_py_exception(R"(Unable to add element of type ")",
-                       type_name, R"(" to message: type is unknown to CAF)");
+      set_py_exception(R"(Unable to add element of type ")", type_name,
+                       R"(" to message: type is unknown to CAF)");
       return;
     }
     kvp->second->append(mb, *i);
@@ -476,12 +461,13 @@
   auto& bindings = s_context->cfg.portable_bindings();
   pybind11::tuple result(msg.size());
   auto& types = self->system().types();
-  for (size_t i = 0; i  < msg.size(); ++i) {
+  for (size_t i = 0; i < msg.size(); ++i) {
     auto rtti = msg.type(i);
     auto str = types.portable_name(rtti);
     if (str == types.default_type_name()) {
-      set_py_exception("Unable to extract element #", i, " from message: ",
-                       "could not get portable name of ", rtti.second->name());
+      set_py_exception("Unable to extract element #", i,
+                       " from message: ", "could not get portable name of ",
+                       rtti.second->name());
       return pybind11::tuple{};
     }
     auto kvp = bindings.find(str);
@@ -534,8 +520,8 @@

 template <class Processor>
 void serialize(Processor& proc, foo& f, const unsigned int) {
-  proc & f.x;
-  proc & f.y;
+  proc& f.x;
+  proc& f.y;
 }

 std::string to_string(const foo& x) {
@@ -545,20 +531,20 @@
 void register_class(foo*, pybind11::module& m, const std::string& name) {
   std::string (*str_fun)(const foo&) = &to_string;
   pybind11::class_<foo>(m, name.c_str())
-  .def(pybind11::init<>())
-  .def(pybind11::init<int, int>())
-  .def("__str__", str_fun)
-  .def("__repr__", str_fun)
-  .def_readwrite("x", &foo::x)
-  .def_readwrite("y", &foo::y);
+    .def(pybind11::init<>())
+    .def(pybind11::init<int, int>())
+    .def("__str__", str_fun)
+    .def("__repr__", str_fun)
+    .def_readwrite("x", &foo::x)
+    .def_readwrite("y", &foo::y);
 }

 #if PY_MAJOR_VERSION == 3
-#define CAF_MODULE_INIT_RES PyObject*
-#define CAF_MODULE_INIT_RET(res) return res;
+#  define CAF_MODULE_INIT_RES PyObject*
+#  define CAF_MODULE_INIT_RET(res) return res;
 #else
-#define CAF_MODULE_INIT_RES void
-#define CAF_MODULE_INIT_RET(unused)
+#  define CAF_MODULE_INIT_RES void
+#  define CAF_MODULE_INIT_RET(unused)
 #endif

 CAF_MODULE_INIT_RES caf_module_init() {
@@ -567,10 +553,11 @@
   // add classes
   // add free functions
   m.def("send", &py_send, "Sends a message to an actor")
-   .def("dequeue_message", &py_dequeue, "Receives the next message")
-   .def("dequeue_message_with_timeout", &py_dequeue_with_timeout, "Receives the next message")
-   .def("self", &py_self, "Returns the global self handle")
-   .def("atom", &atom_from_string, "Creates an atom from a string");
+    .def("dequeue_message", &py_dequeue, "Receives the next message")
+    .def("dequeue_message_with_timeout", &py_dequeue_with_timeout,
+         "Receives the next message")
+    .def("self", &py_self, "Returns the global self handle")
+    .def("atom", &atom_from_string, "Creates an atom from a string");
   CAF_MODULE_INIT_RET(m.ptr())
 }

@@ -590,7 +577,7 @@
   config() {
     add_message_type<foo>("foo");
     opt_group{custom_options_, "python"}
-    .add(py_file, "file,f", "Run script instead of interactive shell.");
+      .add(py_file, "file,f", "Run script instead of interactive shell.");
   }
 };

@@ -605,7 +592,7 @@
   // create Python module for CAF
   int py_res = 0;
   if (!cfg.py_file.empty()) {
-    auto fp = fopen(cfg.py_file.c_str() , "r");
+    auto fp = fopen(cfg.py_file.c_str(), "r");
     if (fp == nullptr) {
       cerr << "Unable to open file " << cfg.py_file << endl;
       Py_Finalize();


fixed population bug

fixed population bug

--- client/main.cpp
+++ client/main.cpp
@@ -93,10 +93,10 @@
         // do client creation multi-threaded as it may take a while
         LOG_DEBUG("Start client creation.");
         auto sumClients = hosts.size() * numClients;
-        std::vector<tpch::Client> clients;
+        std::vector<std::unique_ptr<tpch::Client>> clients;
         clients.reserve(sumClients);
         for (decltype(sumClients) i = 0; i < sumClients; ++i) {
-            clients.emplace_back(service, endTime, batchSize);
+            clients.emplace_back(new tpch::Client(service, endTime, batchSize));
         }
         LOG_DEBUG("Client creation finished.");

@@ -114,7 +114,7 @@
             }
             for (unsigned j = 0; j < numClients; ++j) {
                 LOG_INFO("Connected to client " + crossbow::to_string(i*numClients + j));
-                boost::asio::connect(clients[i*numClients + j].socket(), iter);
+                boost::asio::connect(clients[i*numClients + j]->socket(), iter);
             }
         }

@@ -128,7 +128,7 @@

         if (exit) {
             for (auto& client : clients) {
-                auto& cmds = client.commands();
+                auto& cmds = client->commands();
                 cmds.execute<tpch::Command::EXIT>([](const err_code& ec){
                     if (ec) {
                         std::cerr << "ERROR: " << ec.message() << std::endl;
@@ -139,7 +139,7 @@
         }

         if (populate) {
-            auto& cmds = clients[0].commands();
+            auto& cmds = clients[0]->commands();
             double scalingFactor = tpch::getScalingFactor(baseDir);
             cmds.execute<tpch::Command::CREATE_SCHEMA>(
                     [&clients, &baseDir, &scalingFactor](const err_code& ec,
@@ -153,7 +153,7 @@
                     return;
                 }

-                auto& cmds = clients[0].commands();
+                auto& cmds = clients[0]->commands();
                 // populates regions and nations, and other tables if they are not split
                 cmds.execute<tpch::Command::POPULATE>([&clients, &baseDir, &scalingFactor](const err_code& ec, const std::tuple<bool, crossbow::string>& res){
                     if (ec) {
@@ -167,7 +167,7 @@

                     // populates split files of other tables
                     for (uint32_t i = 0; i < clients.size(); ++i) {
-                        clients[i].populate(baseDir, i);
+                        clients[i]->populate(baseDir, i);
                     }
                 }, std::make_pair(uint32_t(0), crossbow::string(baseDir)));
             }, scalingFactor);
@@ -176,7 +176,7 @@
             threads.reserve(threads.size());
             for (uint32_t i = 0; i < clients.size(); ++i) {
                 threads.emplace_back([&, i]{
-                    clients[i].prepare(baseDir, uint(i));
+                    clients[i]->prepare(baseDir, uint(i));
                 });
             }

@@ -185,7 +185,7 @@
             }

             for (auto& client : clients) {
-                client.run();
+                client->run();
             }
         }
 END:
@@ -194,7 +194,7 @@
         std::ofstream out(outFile.c_str());
         out << "start,end,transaction,success,error\n";
         for (const auto& client : clients) {
-            const auto& queue = client.log();
+            const auto& queue = client->log();
             for (const auto& e : queue) {
                 crossbow::string tName;
                 switch (e.transaction) {


Include argument type for parameters

Include argument type for parameters

--- libvast/src/command.cpp
+++ libvast/src/command.cpp
@@ -129,10 +129,14 @@
 // Returns the field size for printing all names in `xs`.
 auto field_size(const caf::config_option_set& xs) {
   return accumulate(xs.begin(), xs.end(), size_t{0}, [](size_t x, auto& y) {
-    // We print parameters in the form "[-h | -? | --help]". So, "[]" adds 2
-    // characters, each short name adds 5 characters with "-X | " and the
-    // long name finally gets the prefix "--".
-    return std::max(x, 4 + (y.short_names().size() * 5) + y.long_name().size());
+    // We print parameters in the form "[-h | -? | --help] <type>" (but we omit
+    // the type for boolean). So, "[]" adds 2 characters, each short name adds
+    // 5 characters with "-X | ", the long name gets the 2 character prefix
+    // "--", and finally we add an extra space plus the type name.
+    auto tname = y.type_name();
+    auto tname_size = tname == "boolean" ? 0u : tname.size() + 3;
+    return std::max(x, 4 + (y.short_names().size() * 5) + y.long_name().size()
+                         + tname_size);
   });
 }

@@ -150,6 +154,12 @@
     lst += "--";
     lst.insert(lst.end(), opt.long_name().begin(), opt.long_name().end());
     lst += ']';
+    auto tname = opt.type_name();
+    if (tname != "boolean") {
+      lst += " <";
+      lst.insert(lst.end(), tname.begin(), tname.end());
+      lst += '>';
+    }
     out.width(fs);
     out << lst << "  " << opt.description() << '\n';
   }


init: Print time at boot

init: Print time at boot

--- bin/init.cc
+++ bin/init.cc
@@ -5,6 +5,7 @@
 #include <fcntl.h>
 #include "lib.h"
 #include "major.h"
+#include <time.h>

 static const char *sh_argv[] = { "sh", 0 };
 static const char *app_argv[][MAXARG] = {
@@ -90,6 +91,9 @@
   for (u32 i = 0; i < NELEM(app_argv); i++)
     startone(app_argv[i]);

+  time_t now = time(nullptr);
+  printf("init complete at %s", ctime(&now));
+
   runcmdline();

   for(;;){


[local.dof-vector] add missing type to trais

--- dune/gdt/local/dof-vector.hh
+++ dune/gdt/local/dof-vector.hh
@@ -51,6 +51,7 @@
 public:
   using derived_type = ConstLocalDofVector<Vector, GridView>;
   using ScalarType = typename Vector::ScalarType;
+  using RealType = typename Vector::RealType;
 };

@@ -62,6 +63,7 @@
 public:
   using derived_type = LocalDofVector<Vector, GridView>;
   using ScalarType = typename Vector::ScalarType;
+  using RealType = typename Vector::RealType;
 };


responder : Improve tracing to debug problems

Improving the tracing , so that when we see it on journal
we can actually find some thing useful & hopefully be able
to find the root cause of the problem.

Signed-off-by: Manojkiran Eda <58c0f11b20f4eee4270d60d1871d69f99fda7b66@gmail.com>
Change-Id: Id589a36db81300f9ca3cc8553a72141865e15a10

--- libpldmresponder/platform_state_sensor.hpp
+++ libpldmresponder/platform_state_sensor.hpp
@@ -52,7 +52,9 @@
     }
     catch (const std::exception& e)
     {
-        std::cerr << e.what() << '\n';
+        std::cerr << "Get StateSensor EventState from dbus Error, interface : "
+                  << dbusMapping.objectPath.c_str()
+                  << " ,exception : " << e.what() << '\n';
     }

     return PLDM_SENSOR_UNKNOWN;


Fix create memory block pairs

Fix create memory block pairs

--- src/med/Snapshot.cpp
+++ src/med/Snapshot.cpp
@@ -85,8 +85,8 @@
   MemAddr lastAddress1 = firstAddress1 + block1.getSize();
   MemAddr firstAddress2 = block2.getAddress();
   MemAddr lastAddress2 = firstAddress2 + block2.getSize();
-  return (firstAddress1 <= firstAddress2 && lastAddress1 >= firstAddress2) ||
-    (firstAddress1 <= lastAddress2 && lastAddress1 >= lastAddress2);
+  return (firstAddress1 <= firstAddress2 && lastAddress1 > firstAddress2) ||
+    (firstAddress1 < lastAddress2 && lastAddress1 >= lastAddress2);
 }

 vector<SnapshotScanPtr> Snapshot::filterUnknown(const MemoryBlockPairs& pairs, const ScanParser::OpType& opType, const ScanType& scanType) {


Faster bilinear interpolation

Faster bilinear interpolation

--- newbase/NFmiInterpolation.cpp
+++ newbase/NFmiInterpolation.cpp
@@ -41,9 +41,12 @@
   // Handle special case where X1==X2
   if (theX1 == theX2)
   {
-    if (theX != theX1) return kFloatMissing;
-    if (theY1 == kFloatMissing || theY2 == kFloatMissing) return kFloatMissing;
-    if (theY1 != theY2) return kFloatMissing;
+    if (theX != theX1)
+      return kFloatMissing;
+    if (theY1 == kFloatMissing || theY2 == kFloatMissing)
+      return kFloatMissing;
+    if (theY1 != theY2)
+      return kFloatMissing;
     return theY1;
   }
   else
@@ -134,10 +137,14 @@

   // Grid cell edges

-  if (dy == 0) return WindVector(dx, theBottomLeft, theBottomRight);
-  if (dy == 1) return WindVector(dx, theTopLeft, theTopRight);
-  if (dx == 0) return WindVector(dy, theBottomLeft, theTopLeft);
-  if (dx == 1) return WindVector(dy, theBottomRight, theTopRight);
+  if (dy == 0)
+    return WindVector(dx, theBottomLeft, theBottomRight);
+  if (dy == 1)
+    return WindVector(dx, theTopLeft, theTopRight);
+  if (dx == 0)
+    return WindVector(dy, theBottomLeft, theTopLeft);
+  if (dx == 1)
+    return WindVector(dy, theBottomRight, theTopRight);

   return kFloatMissing;
 }
@@ -186,9 +193,12 @@
   // Handle special case where X1==X2
   if (theX1 == theX2)
   {
-    if (theX != theX1) return kFloatMissing;
-    if (theY1 == kFloatMissing || theY2 == kFloatMissing) return kFloatMissing;
-    if (theY1 != theY2) return kFloatMissing;
+    if (theX != theX1)
+      return kFloatMissing;
+    if (theY1 == kFloatMissing || theY2 == kFloatMissing)
+      return kFloatMissing;
+    if (theY1 != theY2)
+      return kFloatMissing;
     return theY1;
   }
   else
@@ -265,10 +275,14 @@

   // Grid cell edges

-  if (dy == 0) return Linear(dx, theBottomLeft, theBottomRight);
-  if (dy == 1) return Linear(dx, theTopLeft, theTopRight);
-  if (dx == 0) return Linear(dy, theBottomLeft, theTopLeft);
-  if (dx == 1) return Linear(dy, theBottomRight, theTopRight);
+  if (dy == 0)
+    return Linear(dx, theBottomLeft, theBottomRight);
+  if (dy == 1)
+    return Linear(dx, theTopLeft, theTopRight);
+  if (dx == 0)
+    return Linear(dy, theBottomLeft, theTopLeft);
+  if (dx == 1)
+    return Linear(dy, theBottomRight, theTopRight);

   // If only one corner is missing, interpolate within
   // the triangle formed by the three points, AND now
@@ -324,7 +338,10 @@
   double distance_;                    // Etäisyys referenssi pisteeseen
 };

-bool operator<(const PointData &p1, const PointData &p2) { return p1.distance_ < p2.distance_; }
+bool operator<(const PointData &p1, const PointData &p2)
+{
+  return p1.distance_ < p2.distance_;
+}
 PointData CalcPointData(const NFmiPoint &referencePoint,
                         const NFmiPoint &cornerPoint,
                         FmiDirection corner,
@@ -370,7 +387,8 @@
       CalcPointData(referencePoint, NFmiPoint(1, 0), kBottomRight, theBottomRight));
   for (const auto &pointData : sortedPointValues)
   {
-    if (pointData.value_ != kFloatMissing) return pointData.value_;
+    if (pointData.value_ != kFloatMissing)
+      return pointData.value_;
   }
   return kFloatMissing;
 }
@@ -435,14 +453,19 @@
                    const NFmiPoint &theBottomLeft,
                    const NFmiPoint &theBottomRight)
 {
-  double dx = theX;
-  double dy = theY;
-
-  double x = ((1 - dx) * (1 - dy) * theBottomLeft.X() + dx * (1 - dy) * theBottomRight.X() +
-              (1 - dx) * dy * theTopLeft.X() + dx * dy * theTopRight.X());
-
-  double y = ((1 - dx) * (1 - dy) * theBottomLeft.Y() + dx * (1 - dy) * theBottomRight.Y() +
-              (1 - dx) * dy * theTopLeft.Y() + dx * dy * theTopRight.Y());
+  const auto dx = theX;
+  const auto dy = theY;
+  const auto xd = 1 - dx;
+  const auto yd = 1 - dy;
+  const auto bottomleft = xd * yd;
+  const auto bottomright = dx * yd;
+  const auto topleft = xd * dy;
+  const auto topright = dx * dy;
+
+  const auto x = bottomleft * theBottomLeft.X() + bottomright * theBottomRight.X() +
+                 topleft * theTopLeft.X() + topright * theTopRight.X();
+  const auto y = bottomleft * theBottomLeft.Y() + bottomright * theBottomRight.Y() +
+                 topleft * theTopLeft.Y() + topright * theTopRight.Y();

   return NFmiPoint(x, y);
 }
@@ -491,10 +514,14 @@

   // Grid cell edges

-  if (dy == 0) return ModLinear(dx, theBottomLeft, theBottomRight, theModulo);
-  if (dy == 1) return ModLinear(dx, theTopLeft, theTopRight, theModulo);
-  if (dx == 0) return ModLinear(dy, theBottomLeft, theTopLeft, theModulo);
-  if (dx == 1) return ModLinear(dy, theBottomRight, theTopRight, theModulo);
+  if (dy == 0)
+    return ModLinear(dx, theBottomLeft, theBottomRight, theModulo);
+  if (dy == 1)
+    return ModLinear(dx, theTopLeft, theTopRight, theModulo);
+  if (dx == 0)
+    return ModLinear(dy, theBottomLeft, theTopLeft, theModulo);
+  if (dx == 1)
+    return ModLinear(dy, theBottomRight, theTopRight, theModulo);

   // If only one corner is missing, interpolate within
   // the triangle formed by the three points, but not
@@ -503,7 +530,8 @@
   if (theTopLeft == kFloatMissing && theTopRight != kFloatMissing &&
       theBottomLeft != kFloatMissing && theBottomRight != kFloatMissing)
   {
-    if (dx < dy) return kFloatMissing;
+    if (dx < dy)
+      return kFloatMissing;
     calculator(static_cast<float>(theBottomLeft), static_cast<float>((1 - dx) * (1 - dy)));
     calculator(static_cast<float>(theBottomRight), static_cast<float>(dx * (1 - dy)));
     calculator(static_cast<float>(theTopRight), static_cast<float>(dx * dy));
@@ -512,7 +540,8 @@
   else if (theTopLeft != kFloatMissing && theTopRight == kFloatMissing &&
            theBottomLeft != kFloatMissing && theBottomRight != kFloatMissing)
   {
-    if (1 - dx < dy) return kFloatMissing;
+    if (1 - dx < dy)
+      return kFloatMissing;
     calculator(static_cast<float>(theTopLeft), static_cast<float>((1 - dx) * dy));
     calculator(static_cast<float>(theBottomLeft), static_cast<float>((1 - dx) * (1 - dy)));
     calculator(static_cast<float>(theBottomRight), static_cast<float>(dx * (1 - dy)));
@@ -521,7 +550,8 @@
   else if (theTopLeft != kFloatMissing && theTopRight != kFloatMissing &&
            theBottomLeft == kFloatMissing && theBottomRight != kFloatMissing)
   {
-    if (1 - dx > dy) return kFloatMissing;
+    if (1 - dx > dy)
+      return kFloatMissing;
     calculator(static_cast<float>(theBottomRight), static_cast<float>(dx * (1 - dy)));
     calculator(static_cast<float>(theTopRight), static_cast<float>(dx * dy));
     calculator(static_cast<float>(theTopLeft), static_cast<float>((1 - dx) * dy));
@@ -530,7 +560,8 @@
   else if (theTopLeft != kFloatMissing && theTopRight != kFloatMissing &&
            theBottomLeft != kFloatMissing && theBottomRight == kFloatMissing)
   {
-    if (dx > dy) return kFloatMissing;
+    if (dx > dy)
+      return kFloatMissing;
     calculator(static_cast<float>(theBottomLeft), static_cast<float>((1 - dx) * (1 - dy)));
     calculator(static_cast<float>(theTopLeft), static_cast<float>((1 - dx) * dy));
     calculator(static_cast<float>(theTopRight), static_cast<float>(dx * dy));
@@ -582,7 +613,8 @@

 void WindInterpolator::operator()(double theSpeed, double theDirection, double theWeight)
 {
-  if (theSpeed == kFloatMissing || theDirection == kFloatMissing || theWeight <= 0) return;
+  if (theSpeed == kFloatMissing || theDirection == kFloatMissing || theWeight <= 0)
+    return;

   if (itsCount == 0 || theWeight > itsBestWeight)
   {
@@ -618,7 +650,8 @@

 double WindInterpolator::Speed() const
 {
-  if (itsCount == 0 || itsWeightSum == 0) return kFloatMissing;
+  if (itsCount == 0 || itsWeightSum == 0)
+    return kFloatMissing;

   return itsSpeedSum / itsWeightSum;
 }
@@ -634,7 +667,8 @@

 double WindInterpolator::Direction() const
 {
-  if (itsCount == 0 || itsWeightSum == 0) return kFloatMissing;
+  if (itsCount == 0 || itsWeightSum == 0)
+    return kFloatMissing;

   double x = itsSpeedSumX / itsWeightSum;
   double y = itsSpeedSumY / itsWeightSum;
@@ -642,13 +676,15 @@
   // If there is almost exact cancellation, return best
   // weighted direction instead.

-  if (sqrt(x * x + y * y) < 0.01) return itsBestDirection;
+  if (sqrt(x * x + y * y) < 0.01)
+    return itsBestDirection;

   // Otherwise use the 2D mean

   double dir = atan2(y, x);
   dir = FmiDeg(dir);
-  if (dir < 0) dir += 360;
+  if (dir < 0)
+    dir += 360;
   return dir;
 }


Minor fixes to global search funcion

Minor fixes to global search funcion

--- src/megaapi_impl.cpp
+++ src/megaapi_impl.cpp
@@ -5403,17 +5403,10 @@

         result.insert(result.end(), vNodes.begin(), vNodes.end());
     }
-
-    MegaNodeList *nodeList;
-    if(result.size())
-    {
-        nodeList = new MegaNodeListPrivate(result.data(), result.size());
-    }
-    else
-    {
-        nodeList = new MegaNodeListPrivate();
-    }
-
+    delete shares;
+
+    MegaNodeList *nodeList = new MegaNodeListPrivate(result.data(), result.size());
+
     sdkMutex.unlock();

     return nodeList;
@@ -5527,22 +5520,25 @@

 MegaNodeList* MegaApiImpl::search(MegaNode* n, const char* searchString, bool recursive)
 {
-    if(!n || !searchString) return new MegaNodeListPrivate();
+    if (!n || !searchString)
+    {
+    	return new MegaNodeListPrivate();
+    }
+
     sdkMutex.lock();
-	Node *node = client->nodebyhandle(n->getHandle());
-	if(!node)
-	{
+
+    Node *node = client->nodebyhandle(n->getHandle());
+    if (!node)
+    {
         sdkMutex.unlock();
         return new MegaNodeListPrivate();
-	}
-
-	SearchTreeProcessor searchProcessor(searchString);
-	processTree(node, &searchProcessor, recursive);
+    }
+
+    SearchTreeProcessor searchProcessor(searchString);
+    processTree(node, &searchProcessor, recursive);
     vector<Node *>& vNodes = searchProcessor.getResults();

-    MegaNodeList *nodeList;
-    if(vNodes.size()) nodeList = new MegaNodeListPrivate(vNodes.data(), vNodes.size());
-    else nodeList = new MegaNodeListPrivate();
+    MegaNodeList *nodeList = new MegaNodeListPrivate(vNodes.data(), vNodes.size());

     sdkMutex.unlock();


Refactor FileInputSource::seek and FileInputSource::unreadCh

Avoid building error message each call "just in case".

--- libqpdf/FileInputSource.cc
+++ libqpdf/FileInputSource.cc
@@ -102,11 +102,12 @@
 void
 FileInputSource::seek(qpdf_offset_t offset, int whence)
 {
-    QUtil::os_wrapper(
-        (std::string("seek to ") + this->filename + ", offset " +
-         QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
-         ")"),
-        QUtil::seek(this->file, offset, whence));
+    if (QUtil::seek(this->file, offset, whence) == -1) {
+        QUtil::throw_system_error(
+            std::string("seek to ") + this->filename + ", offset " +
+            QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
+            ")");
+    }
 }

 void
@@ -140,7 +141,7 @@
 void
 FileInputSource::unreadCh(char ch)
 {
-    QUtil::os_wrapper(
-        this->filename + ": unread character",
-        ungetc(static_cast<unsigned char>(ch), this->file));
+    if (ungetc(static_cast<unsigned char>(ch), this->file) == -1) {
+        QUtil::throw_system_error(this->filename + ": unread character");
+    }
 }


clipp: Improve output of exceptions.

clipp: Improve output of exceptions.

--- clipp/clipp.cpp
+++ clipp/clipp.cpp
@@ -86,6 +86,7 @@
 #include <boost/algorithm/string/join.hpp>
 #include <boost/call_traits.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/exception/all.hpp>

 #include <string>

@@ -346,6 +347,16 @@

 ///@}

+#define CLIPP_CATCH(message, action) \
+ catch (const boost::exception& e) { \
+     cerr << (message) << ": " << diagnostic_information(e) << endl; \
+     (action); \
+ } \
+ catch (const exception& e) { \
+     cerr << (message) << ": " << e.what() << endl; \
+     (action); \
+ }
+
 /**
  * Main
  *
@@ -418,11 +429,7 @@
         try {
             chains = ConfigurationParser::parse_file(path);
         }
-        catch (const exception& e) {
-            cerr << "Error parsing configuration file " << path
-                 << ": " << e.what() << endl;
-            return 1;
-        }
+        CLIPP_CATCH("Error parsing configuraiton file", {return 1;});

         copy(
             chains.begin(), chains.end(),
@@ -437,10 +444,8 @@
     try {
         chains = ConfigurationParser::parse_string(configuration);
     }
-    catch (const exception& e) {
-        cerr << "Error parsing configuration: " << e.what() << endl;
-        return 1;
-    }
+    CLIPP_CATCH("Error parsing configuration", {return 1;});
+
     copy(
         chains.begin(), chains.end(),
         back_inserter(all_chains)
@@ -462,10 +467,7 @@
             consumer_factory_map
         );
     }
-    catch (const exception& e) {
-        cerr << "Error constructing consumer: " << e.what() << endl;
-        return 1;
-    }
+    CLIPP_CATCH("Error constructing consumer", {return 1;});

     // Loop through components, generating and processing input generators
     // as needed to limit the scope of each input generator.  As input
@@ -479,11 +481,10 @@
                 generator_factory_map
             );
         }
-        catch (const exception& e) {
-            cerr << "Error constructing generator " << chain.base.name
-                 << ": " << e.what() << endl;
-           return 1;
-        }
+        CLIPP_CATCH(
+            "Error constructing generator " + chain.base.name,
+            {return 1;}
+        );

         // Append consumer modifiers
         copy(
@@ -509,11 +510,10 @@
                     modifier_factory_map
                 );
             }
-            catch (const exception& e) {
-                cerr << "Error constructing modifier "
-                     << modifier_component.name << ": " << e.what() << endl;
-                return 1;
-            }
+            CLIPP_CATCH(
+                "Error constructing modifier " + modifier_component.name,
+                {return 1;}
+            );
         }

         // Process inputs.
@@ -528,10 +528,7 @@
             try {
                 generator_continue = generator(input);
             }
-            catch (const exception& e) {
-                cerr << "Error generating input: " << e.what() << endl;
-                continue;
-            }
+            CLIPP_CATCH("Error generating input", {continue;});

             if (generator_continue && ! input) {
                 cerr << "Generator said it provided input, but didn't."
@@ -549,13 +546,12 @@
                 try {
                     modifier_continue = modifier_info.second(input);
                 }
-                catch (const exception& e) {
+                CLIPP_CATCH(
                     cerr << "Error applying modifier "
-                         << modifier_info.first << ": " << e.what()
-                         << endl;
-                    modifier_continue = false;
-                    break;
-                }
+                         << modifier_info.first,
+                    {modifier_continue = false; break;}
+                );
+
                 // If pushing through a singular input, apply to all
                 // modifier.
                 if (input && ! modifier_continue) {
@@ -579,10 +575,8 @@
             try {
                 consumer_continue = consumer(input);
             }
-            catch (const exception& e) {
-                cerr << "Error consuming input: " << e.what() << endl;
-                continue;
-            }
+            CLIPP_CATCH("Error consuming input", {continue;});
+
             if (! consumer_continue) {
                 cerr << "Consumer refusing input." << endl;
             }


Added missing case as stub to ACallbacks::report_analysis_errors to
remove compiler warning.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@6327 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

--- compiler/analysis/chapel_ifa.cpp
+++ compiler/analysis/chapel_ifa.cpp
@@ -2144,6 +2144,8 @@
         analysis_error(AERROR_CALL_ARGUMENT, v->send, v->type, v->av); break;
       case ATypeViolation_BOXING:
         analysis_error(AERROR_CALL_ARGUMENT, v->send, v->type, v->av); break;
+      case ATypeViolation_CLOSURE_RECURSION:
+        /* SJD: Added to remove compiler warning */ break;
     }
   }
   reportAnalysisErrors(&analysis_errors);


Rebased off master

Rebased off master

--- dynd/src/array_functions.cpp
+++ dynd/src/array_functions.cpp
@@ -769,9 +769,9 @@

   // Clone the data pointer
   result.get()->data = n.get()->data;
-  result.get()->ref = n.get()->ref;
-  if (!result.get()->ref) {
-    result.get()->ref = n;
+  result.get()->owner = n.get()->owner;
+  if (!result.get()->owner) {
+    result.get()->owner = n;
   }

   // Copy the flags


Fixed initial peer packet not getting processed

--- Core/Contents/Source/PolyPeer.cpp
+++ Core/Contents/Source/PolyPeer.cpp
@@ -185,7 +185,7 @@
 }

 bool Peer::checkPacketAcks(PeerConnection *connection, Packet *packet) {
-	if(packet->header.sequence > connection->remoteSequence) {
+	if(packet->header.sequence > connection->remoteSequence || connection->remoteSequence == 0) {
 		connection->remoteSequence = packet->header.sequence;
 	} else {
 		return false;


Inserted the derivative of the correction functions for the Flux Recontruction approach.

git-svn-id: b7791fb0f5d07d96612766859ad70a13be88ea96@3538 305cdda6-5ce1-45b3-a98d-dfc68c8b3305

--- library/LibUtilities/Foundations/Basis.cpp
+++ library/LibUtilities/Foundations/Basis.cpp
@@ -100,7 +100,7 @@
             m_bdata(bkey.GetTotNumModes()*bkey.GetTotNumPoints()),
             m_dbdata(bkey.GetTotNumModes()*bkey.GetTotNumPoints())
         {
-	  m_InterpManager.RegisterGlobalCreator(boost::bind(&Basis::CalculateInterpMatrix,this,_1));
+            m_InterpManager.RegisterGlobalCreator(boost::bind(&Basis::CalculateInterpMatrix,this,_1));
         }

         boost::shared_ptr<Basis> Basis::Create(const BasisKey &bkey)
@@ -124,32 +124,32 @@
         */
         boost::shared_ptr< NekMatrix<NekDouble> > Basis::CalculateInterpMatrix(const BasisKey &tbasis0)
         {
-	  int dim = m_basisKey.GetNumModes();
-	  const PointsKey pkey(dim,LibUtilities::eGaussLobattoLegendre);
-	  BasisKey fbkey(m_basisKey.GetBasisType(),dim,pkey);
-	  BasisKey tbkey(tbasis0.GetBasisType(),dim,pkey);
-
-	  // "Constructur" of the basis
-	  BasisSharedPtr fbasis = BasisManager()[fbkey];
-	  BasisSharedPtr tbasis = BasisManager()[tbkey];
-
-	  // Get B Matrices
-	  Array<OneD, NekDouble> fB_data = fbasis->GetBdata();
-	  Array<OneD, NekDouble> tB_data = tbasis->GetBdata();
-
-	  // Convert to a NekMatrix
-	  NekMatrix<NekDouble> fB(dim,dim,fB_data);
-	  NekMatrix<NekDouble> tB(dim,dim,tB_data);
-
-	  // Invert the "to" matrix: tu = tB^(-1)*fB fu = ftB fu
-	  tB.Invert();
-
-	  // Compute transformation matrix
-	  Array<OneD, NekDouble> zero1D(dim*dim,0.0);
-	  boost::shared_ptr< NekMatrix<NekDouble> > ftB(MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(dim,dim,zero1D));
-	  (*ftB) = tB*fB;
-
-	  return ftB;
+            int dim = m_basisKey.GetNumModes();
+            const PointsKey pkey(dim,LibUtilities::eGaussLobattoLegendre);
+            BasisKey fbkey(m_basisKey.GetBasisType(),dim,pkey);
+            BasisKey tbkey(tbasis0.GetBasisType(),dim,pkey);
+
+            // "Constructur" of the basis
+            BasisSharedPtr fbasis = BasisManager()[fbkey];
+            BasisSharedPtr tbasis = BasisManager()[tbkey];
+
+            // Get B Matrices
+            Array<OneD, NekDouble> fB_data = fbasis->GetBdata();
+            Array<OneD, NekDouble> tB_data = tbasis->GetBdata();
+
+            // Convert to a NekMatrix
+            NekMatrix<NekDouble> fB(dim,dim,fB_data);
+            NekMatrix<NekDouble> tB(dim,dim,tB_data);
+
+            // Invert the "to" matrix: tu = tB^(-1)*fB fu = ftB fu
+            tB.Invert();
+
+            // Compute transformation matrix
+            Array<OneD, NekDouble> zero1D(dim*dim,0.0);
+            boost::shared_ptr< NekMatrix<NekDouble> > ftB(MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(dim,dim,zero1D));
+            (*ftB) = tB*fB;
+
+            return ftB;
         }

         // Method used to generate appropriate basis
@@ -243,7 +243,7 @@
             case eOrtho_A:
             case eLegendre:
                 mode = m_bdata.data();
-
+
                 for (p=0; p<numModes; ++p, mode += numPoints)
                 {
                     Polylib::jacobfd(numPoints, z.data(), mode, NULL, p, 0.0, 0.0);
@@ -599,7 +599,7 @@
                     numPoints);
                 break;

-             case eMonomial:
+            case eMonomial:
                 {
                  int P = numModes - 1;
                  NekDouble *mode = m_bdata.data();
@@ -617,7 +617,340 @@
                                 m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
                 }
                 break;
-
+
+            /** \brief Left derivative of the correction function for FR DG method (see J Sci Comput (2011) 47: 50–72)
+
+                \f$\tilde dGL_{DG} = = (-1)^{p}/2( d(L_(p-1)) - d(L_{p}) ) = \f$
+
+            */
+            case eDG_DG_Left:
+                {
+                    // Number of modes (here the left and right polynomials DG_DG of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+                    std::cout << "numModes = " << numModes << std::endl;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_DG
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_DG recovering the DG scheme
+                    NekDouble etap = 0.0;
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Left_DG
+                    for(int i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i]  = dLp[i] - mode[i];
+                        mode[i]  = 0.5 * sign * m_bdata[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                      //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                      //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+
+                /** \brief Right derivative of the correction function for FR DG method (see J Sci Comput (2011) 47: 50–72)
+
+                    \f$\tilde dGR_{DG} = = 1/2( d(L_{p-1}) + d(L_{p}) ) = \f$
+
+                */
+                case eDG_DG_Right:
+                {
+                    // Number of modes (here the left and right polynomials DG_DG of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_DG
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_DG recovering the DG scheme
+                    NekDouble etap = 0.0;
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Right
+                    for(int i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i] += dLp[i];
+                        mode[i]  = 0.5 * mode[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                    //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                    //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+
+                /** \brief Left derivative of the correction function for FR SD method (see J Sci Comput (2011) 47: 50–72)
+
+                    \f$\tilde dGL_{SD} = = (-1)^{p}/2( d(L_{p}) - (pd(L_{p-1}) + (p+1)d(L_{p+1}))/(2p + 1) ) = \f$
+
+                */
+                case eDG_SD_Left:
+                {
+                    // Number of modes (here the left and right polynomials DG_SD of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_Left_SD
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_SD recovering the SD scheme
+                    NekDouble etap = p / (1.0 + p);
+
+                    // Factor to build up DG_Left_SD
+                    NekDouble overeta = 1.0 / (1.0 + etap);
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Left_SD
+                    for(i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i] *= overeta;
+                        mode[i]  = dLp[i] - mode[i];
+                        mode[i]  = 0.5 * sign * mode[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                    //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                    //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+                /** \brief Right derivative of the correction function for FR SD method (see J Sci Comput (2011) 47: 50–72)
+
+                    \f$\tilde dGR_{SD} = = 1/2( d(L_{p}) + (pd(L_{p-1}) + (p+1)d(L_{p+1}))/(2p + 1) ) = \f$
+
+                */
+                case eDG_SD_Right:
+                {
+                    // Number of modes (here the left and right polynomials DG_SD of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_Left_SD
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_SD recovering the SD scheme
+                    NekDouble etap = p / (1.0 + p);
+
+                    // Factor to build up DG_Left_SD
+                    NekDouble overeta = 1.0 / (1.0 + etap);
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Right_SD
+                    for(i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i] *= overeta;
+                        mode[i] += dLp[i];
+                        mode[i]  = 0.5 * mode[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                    //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                    //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+
+                /** \brief Left derivative of the correction function for FR HU method (see J Sci Comput (2011) 47: 50–72)
+
+                    \f$\tilde dGL_{HU} = = (-1)^{p}/2( d(L_{p}) - ((p+1)d(L_{p-1}) + pd(L_{p+1}))/(2p + 1) ) = \f$
+
+                */
+                case eDG_HU_Left:
+                {
+                    // Number of modes (here the left and right polynomials DG_HU of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_Left_HU
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_HU recovering the HU scheme
+                    NekDouble etap = (1.0 + p) / p;
+
+                    // Factor to build up DG_Left_HU
+                    NekDouble overeta = 1.0 / (1.0 + etap);
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Left_HU
+                    for(i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i] *= overeta;
+                        mode[i]  = dLp[i] - mode[i];
+                        mode[i]  = 0.5 * sign * mode[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                    //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                    //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+                /** \brief Right derivative of the correction function for FR HU method (see J Sci Comput (2011) 47: 50–72)
+
+                    \f$\tilde dGR_{SD} = = 1/2( d(L_{p}) + ((p+1)d(L_{p-1}) + pd(L_{p+1}))/(2p + 1) ) = \f$
+
+                */
+                case eDG_HU_Right:
+                {
+                    // Number of modes (here the left and right polynomials DG_HU of degree p + 1 are stored)
+                    mode = m_bdata.data();
+                    int p = numModes - 1;
+
+                    // Auxiliary vectors to build up the auxiliary Legendre polynomials
+                    Array<OneD,NekDouble> dLp   (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpp  (numPoints, 0.0);
+                    Array<OneD,NekDouble> dLpm  (numPoints, 0.0);
+
+                    // Function sign to build up DG_Left_HU
+                    NekDouble sign = pow(-1.0, p);
+
+                    // Factor to build up DG_Left_HU recovering the HU scheme
+                    NekDouble etap = (1.0 + p) / p;
+
+                    // Factor to build up DG_Left_HU
+                    NekDouble overeta = 1.0 / (1.0 + etap);
+
+                    // Derivative of the Legendre polynomials
+                    // dLp  = derivative of the Legendre polynomial of order p
+                    // dLpp = derivative of the Legendre polynomial of order p+1
+                    // dLpm = derivative of the Legendre polynomial of order p-1
+                    Polylib::jacobd(numPoints, z.data(), &(dLp[0]),  p,   0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpp[0]), p+1, 0.0, 0.0);
+                    Polylib::jacobd(numPoints, z.data(), &(dLpm[0]), p-1, 0.0, 0.0);
+
+                    // Building the DG_Right_HU
+                    for(i = 0; i < numPoints; ++i)
+                    {
+                        mode[i]  = etap * dLpm[i];
+                        mode[i] += dLpp[i];
+                        mode[i] *= overeta;
+                        mode[i] += dLp[i];
+                        mode[i]  = 0.5 * mode[i];
+                    }
+
+                    // normalise
+                    //scal = sqrt(0.5*(2.0*p+1.0));
+                    //for(i = 0; i < numPoints; ++i)
+                    //{
+                    //  mode[i] *= scal;
+                    //}
+
+                    // define derivative basis
+                    //Blas::Dgemm('n','n',numPoints,numModes,numPoints,1.0,D,numPoints,
+                    //          m_bdata.data(),numPoints,0.0,m_dbdata.data(),numPoints);
+                }
+                break;
+
+
             default:
                 ASSERTL0(false, "Basis Type not known or "
                     "not implemented at this time.");
@@ -637,9 +970,9 @@
             case eGaussRadauMLegendre:
             case eGaussRadauPLegendre:
             case eGaussLobattoLegendre:
-	    case eGaussKronrodLegendre:
-	    case eGaussRadauKronrodMLegendre:
-	    case eGaussLobattoKronrodLegendre:
+            case eGaussKronrodLegendre:
+            case eGaussRadauKronrodMLegendre:
+            case eGaussLobattoKronrodLegendre:
                 returnval = (GetNumPoints() >= GetNumModes());
                 break;


Remove syncs cache at ESID error

Remove syncs cache at ESID error

--- src/megaapi_impl.cpp
+++ src/megaapi_impl.cpp
@@ -7301,6 +7301,16 @@
         {
             client->sctable->remove();
         }
+
+#ifdef ENABLE_SYNC
+        for (sync_list::iterator it = client->syncs.begin(); it != client->syncs.end(); it++)
+        {
+            if ((*it)->statecachetable)
+            {
+                (*it)->statecachetable->remove();
+            }
+        }
+#endif
         client->locallogout();
     }


Removed main printout.

Removed main printout.

--- cpp/app/App.cpp
+++ cpp/app/App.cpp
@@ -292,8 +292,6 @@
    int rval = EXIT_FAILURE;
    bool success;

-   printf("RUNNING MAIN\n");
-
    // seed random
    Random::seed();


clipp: Beginnings of new, more generic, configuration parser.

--- clipp/clipp.cpp
+++ clipp/clipp.cpp
@@ -69,6 +69,7 @@
 #include <boost/foreach.hpp>
 #include <boost/make_shared.hpp>
 #include <boost/bind.hpp>
+#include <boost/algorithm/string/join.hpp>

 #include <string>

@@ -166,7 +167,7 @@
     "<modifier>  := <component>\n"
     "<component> := <name>:<parameters>\n"
     "             | <name>\n"
-    "             | <component>@<modifier>\n"
+    "             | <component> @<modifier>\n"
     "\n"
     "Generator components produce inputs.\n"
     "Consumer components consume inputs.\n"
@@ -214,7 +215,7 @@
     list<component_t> modifiers;
 };

-chain_t parse_chain(const string& s);
+chain_t parse_chain(const vector<string>& tokens);

 input_generator_t modify_generator(
     input_generator_t generator,
@@ -264,16 +265,41 @@
         args.pop_front();
     }

-    // Parse argv
+    // Convert argv to configuration.
+    // In the future, configuration can also be loaded from files.
+    string configuration = boost::algorithm::join(args, " ");
+
+    // Parse configuration.
+    // Better tokenizer coming.
+    vector<string> tokens = split_on_char(configuration, ' ');
+    vector<vector<string> > chain_tokens;
+    BOOST_FOREACH(const string& token, tokens) {
+        if (token.empty()) {
+            continue;
+        }
+        if (token[0] == '@') {
+            if (chain_tokens.empty()) {
+                cerr << "First component was a modifier." << endl;
+                help();
+                return 1;
+            }
+        }
+        else {
+            chain_tokens.push_back(vector<string>());
+        }
+        chain_tokens.back().push_back(token);
+    }
+
     typedef list<chain_t> chains_t;
     chains_t chains;
     bool had_error = false;
-    BOOST_FOREACH(const string& arg, args) {
+    BOOST_FOREACH(const vector<string>& chain_as_tokens, chain_tokens) {
         try {
-            chains.push_back(parse_chain(arg));
+            chains.push_back(parse_chain(chain_as_tokens));
         }
         catch (const exception& e) {
-            cerr << "Error Parsing Component " << arg << ": "
+            cerr << "Error Parsing Chain for "
+                 << chain_as_tokens.front() << ": "
                  << e.what() << endl;
             had_error = true;
         }
@@ -510,13 +536,18 @@
     return component;
 }

-chain_t parse_chain(const string& s)
+chain_t parse_chain(const vector<string>& tokens)
 {
     chain_t chain;
-    vector<string> components = split_on_char(s, '@');
-    chain.base = parse_component(components[0]);
-    for (int i = 1; i < components.size(); ++i) {
-        chain.modifiers.push_back(parse_component(components[i]));
+    chain.base = parse_component(tokens[0]);
+    for (int i = 1; i < tokens.size(); ++i) {
+        const string& token = tokens[i];
+        if (token[0] != '@') {
+            throw logic_error("Modifier does not begin with @.");
+        }
+        chain.modifiers.push_back(
+            parse_component(token.substr(1))
+        );
     }

     return chain;