| 1874 | 
  | 
    RealType area = getDividingArea(); | 
| 1875 | 
  | 
    areaAccumulator_->add(area); | 
| 1876 | 
  | 
    Mat3x3d hmat = currentSnap_->getHmat(); | 
| 1877 | 
+ | 
    Vector3d u = angularMomentumFluxVector_; | 
| 1878 | 
+ | 
    u.normalize(); | 
| 1879 | 
+ | 
 | 
| 1880 | 
  | 
    seleMan_.setSelectionSet(evaluator_.evaluate()); | 
| 1881 | 
  | 
 | 
| 1882 | 
  | 
    int selei(0); | 
| 1883 | 
  | 
    StuntDouble* sd; | 
| 1884 | 
  | 
    int binNo; | 
| 1885 | 
+ | 
    RealType mass; | 
| 1886 | 
+ | 
    Vector3d vel;  | 
| 1887 | 
+ | 
    Vector3d rPos; | 
| 1888 | 
+ | 
    RealType KE; | 
| 1889 | 
+ | 
    Vector3d L; | 
| 1890 | 
+ | 
    Mat3x3d I; | 
| 1891 | 
+ | 
    RealType r2; | 
| 1892 | 
  | 
 | 
| 1893 | 
  | 
    vector<RealType> binMass(nBins_, 0.0); | 
| 1894 | 
< | 
    vector<RealType> binPx(nBins_, 0.0); | 
| 1895 | 
< | 
    vector<RealType> binPy(nBins_, 0.0); | 
| 1896 | 
< | 
    vector<RealType> binPz(nBins_, 0.0); | 
| 1897 | 
< | 
    vector<RealType> binOmegax(nBins_, 0.0); | 
| 1888 | 
< | 
    vector<RealType> binOmegay(nBins_, 0.0); | 
| 1889 | 
< | 
    vector<RealType> binOmegaz(nBins_, 0.0); | 
| 1894 | 
> | 
    vector<Vector3d> binP(nBins_, V3Zero); | 
| 1895 | 
> | 
    vector<RealType> binOmega(nBins_, 0.0); | 
| 1896 | 
> | 
    vector<Vector3d> binL(nBins_, V3Zero); | 
| 1897 | 
> | 
    vector<Mat3x3d>  binI(nBins_); | 
| 1898 | 
  | 
    vector<RealType> binKE(nBins_, 0.0); | 
| 1899 | 
  | 
    vector<int> binDOF(nBins_, 0); | 
| 1900 | 
  | 
    vector<int> binCount(nBins_, 0); | 
| 1934 | 
  | 
        binNo = int(rPos.length() / binWidth_); | 
| 1935 | 
  | 
      } | 
| 1936 | 
  | 
 | 
| 1937 | 
< | 
      RealType mass = sd->getMass(); | 
| 1938 | 
< | 
      Vector3d vel = sd->getVel(); | 
| 1939 | 
< | 
      Vector3d rPos = sd->getPos() - coordinateOrigin_; | 
| 1940 | 
< | 
      Vector3d aVel = cross(rPos, vel); | 
| 1941 | 
< | 
       | 
| 1937 | 
> | 
      mass = sd->getMass(); | 
| 1938 | 
> | 
      vel = sd->getVel(); | 
| 1939 | 
> | 
      rPos = sd->getPos() - coordinateOrigin_; | 
| 1940 | 
> | 
      KE = mass * vel.lengthSquare(); | 
| 1941 | 
> | 
      L = mass * cross(rPos, vel); | 
| 1942 | 
> | 
      I = outProduct(rPos, rPos) * mass; | 
| 1943 | 
> | 
      r2 = rPos.lengthSquare(); | 
| 1944 | 
> | 
      I(0, 0) += mass * r2; | 
| 1945 | 
> | 
      I(1, 1) += mass * r2; | 
| 1946 | 
> | 
      I(2, 2) += mass * r2; | 
| 1947 | 
> | 
 | 
| 1948 | 
> | 
      // Project the relative position onto a plane perpendicular to | 
| 1949 | 
> | 
      // the angularMomentumFluxVector: | 
| 1950 | 
> | 
      // Vector3d rProj = rPos - dot(rPos, u) * u; | 
| 1951 | 
> | 
      // Project the velocity onto a plane perpendicular to the | 
| 1952 | 
> | 
      // angularMomentumFluxVector: | 
| 1953 | 
> | 
      // Vector3d vProj = vel  - dot(vel, u) * u; | 
| 1954 | 
> | 
      // Compute angular velocity vector (should be nearly parallel to | 
| 1955 | 
> | 
      // angularMomentumFluxVector | 
| 1956 | 
> | 
      // Vector3d aVel = cross(rProj, vProj); | 
| 1957 | 
> | 
 | 
| 1958 | 
  | 
      if (binNo >= 0 && binNo < nBins_)  { | 
| 1959 | 
  | 
        binCount[binNo]++; | 
| 1960 | 
  | 
        binMass[binNo] += mass; | 
| 1961 | 
< | 
        binPx[binNo] += mass*vel.x(); | 
| 1962 | 
< | 
        binPy[binNo] += mass*vel.y(); | 
| 1963 | 
< | 
        binPz[binNo] += mass*vel.z(); | 
| 1964 | 
< | 
        binOmegax[binNo] += aVel.x(); | 
| 1965 | 
< | 
        binOmegay[binNo] += aVel.y(); | 
| 1942 | 
< | 
        binOmegaz[binNo] += aVel.z(); | 
| 1943 | 
< | 
        binKE[binNo] += 0.5 * (mass * vel.lengthSquare()); | 
| 1961 | 
> | 
        binP[binNo] += mass*vel; | 
| 1962 | 
> | 
        //binOmega[binNo] += dot(aVel, u); | 
| 1963 | 
> | 
        binKE[binNo] += KE; | 
| 1964 | 
> | 
        binI[binNo] += I; | 
| 1965 | 
> | 
        binL[binNo] += L; | 
| 1966 | 
  | 
        binDOF[binNo] += 3; | 
| 1967 | 
  | 
         | 
| 1968 | 
  | 
        if (sd->isDirectional()) { | 
| 1969 | 
  | 
          Vector3d angMom = sd->getJ(); | 
| 1970 | 
< | 
          Mat3x3d I = sd->getI(); | 
| 1970 | 
> | 
          Mat3x3d Ia = sd->getI(); | 
| 1971 | 
  | 
          if (sd->isLinear()) { | 
| 1972 | 
  | 
            int i = sd->linearAxis(); | 
| 1973 | 
  | 
            int j = (i + 1) % 3; | 
| 1974 | 
  | 
            int k = (i + 2) % 3; | 
| 1975 | 
< | 
            binKE[binNo] += 0.5 * (angMom[j] * angMom[j] / I(j, j) +  | 
| 1976 | 
< | 
                                   angMom[k] * angMom[k] / I(k, k)); | 
| 1975 | 
> | 
            binKE[binNo] += 0.5 * (angMom[j] * angMom[j] / Ia(j, j) +  | 
| 1976 | 
> | 
                                   angMom[k] * angMom[k] / Ia(k, k)); | 
| 1977 | 
  | 
            binDOF[binNo] += 2; | 
| 1978 | 
  | 
          } else { | 
| 1979 | 
< | 
            binKE[binNo] += 0.5 * (angMom[0] * angMom[0] / I(0, 0) + | 
| 1980 | 
< | 
                                   angMom[1] * angMom[1] / I(1, 1) + | 
| 1981 | 
< | 
                                   angMom[2] * angMom[2] / I(2, 2)); | 
| 1979 | 
> | 
            binKE[binNo] += 0.5 * (angMom[0] * angMom[0] / Ia(0, 0) + | 
| 1980 | 
> | 
                                   angMom[1] * angMom[1] / Ia(1, 1) + | 
| 1981 | 
> | 
                                   angMom[2] * angMom[2] / Ia(2, 2)); | 
| 1982 | 
  | 
            binDOF[binNo] += 3; | 
| 1983 | 
  | 
          } | 
| 1984 | 
  | 
        } | 
| 1986 | 
  | 
    } | 
| 1987 | 
  | 
     | 
| 1988 | 
  | 
#ifdef IS_MPI | 
| 1989 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binCount[0], | 
| 1990 | 
< | 
                              nBins_, MPI::INT, MPI::SUM); | 
| 1991 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binMass[0], | 
| 1992 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 1993 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binPx[0], | 
| 1994 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 1995 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binPy[0], | 
| 1996 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 1997 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binPz[0], | 
| 1998 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 1999 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binOmegax[0], | 
| 2000 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 2001 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binOmegay[0], | 
| 2002 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 2003 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binOmegaz[0], | 
| 2004 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 2005 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binKE[0], | 
| 2006 | 
< | 
                              nBins_, MPI::REALTYPE, MPI::SUM); | 
| 2007 | 
< | 
    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binDOF[0], | 
| 2008 | 
< | 
                              nBins_, MPI::INT, MPI::SUM); | 
| 1989 | 
> | 
 | 
| 1990 | 
> | 
    for (int i = 0; i < nBins_; i++) { | 
| 1991 | 
> | 
 | 
| 1992 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binCount[i], | 
| 1993 | 
> | 
                                1, MPI::INT, MPI::SUM); | 
| 1994 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binMass[i], | 
| 1995 | 
> | 
                                1, MPI::REALTYPE, MPI::SUM); | 
| 1996 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binP[i], | 
| 1997 | 
> | 
                                3, MPI::REALTYPE, MPI::SUM); | 
| 1998 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binL[i], | 
| 1999 | 
> | 
                                3, MPI::REALTYPE, MPI::SUM); | 
| 2000 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binI[i], | 
| 2001 | 
> | 
                                9, MPI::REALTYPE, MPI::SUM); | 
| 2002 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binKE[i], | 
| 2003 | 
> | 
                                1, MPI::REALTYPE, MPI::SUM); | 
| 2004 | 
> | 
      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binDOF[i], | 
| 2005 | 
> | 
                                1, MPI::INT, MPI::SUM); | 
| 2006 | 
> | 
      //MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &binOmega[i], | 
| 2007 | 
> | 
      //                          1, MPI::REALTYPE, MPI::SUM); | 
| 2008 | 
> | 
    } | 
| 2009 | 
> | 
     | 
| 2010 | 
  | 
#endif | 
| 2011 | 
  | 
 | 
| 2012 | 
< | 
    Vector3d vel; | 
| 1990 | 
< | 
    Vector3d aVel; | 
| 2012 | 
> | 
    Vector3d omega; | 
| 2013 | 
  | 
    RealType den; | 
| 2014 | 
  | 
    RealType temp; | 
| 2015 | 
  | 
    RealType z; | 
| 2026 | 
  | 
        den = binMass[i] * 3.0 * PhysicalConstants::densityConvert | 
| 2027 | 
  | 
          / (4.0 * M_PI * (pow(router,3) - pow(rinner,3))); | 
| 2028 | 
  | 
      } | 
| 2029 | 
< | 
      vel.x() = binPx[i] / binMass[i]; | 
| 2008 | 
< | 
      vel.y() = binPy[i] / binMass[i]; | 
| 2009 | 
< | 
      vel.z() = binPz[i] / binMass[i]; | 
| 2010 | 
< | 
      aVel.x() = binOmegax[i] / binCount[i]; | 
| 2011 | 
< | 
      aVel.y() = binOmegay[i] / binCount[i]; | 
| 2012 | 
< | 
      aVel.z() = binOmegaz[i] / binCount[i]; | 
| 2029 | 
> | 
      vel = binP[i] / binMass[i]; | 
| 2030 | 
  | 
 | 
| 2031 | 
+ | 
      omega = binI[i].inverse() * binL[i]; | 
| 2032 | 
+ | 
 | 
| 2033 | 
+ | 
      // omega = binOmega[i] / binCount[i]; | 
| 2034 | 
+ | 
 | 
| 2035 | 
  | 
      if (binCount[i] > 0) { | 
| 2036 | 
  | 
        // only add values if there are things to add | 
| 2037 | 
  | 
        temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb * | 
| 2053 | 
  | 
              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel); | 
| 2054 | 
  | 
              break; | 
| 2055 | 
  | 
            case ANGULARVELOCITY:   | 
| 2056 | 
< | 
              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(aVel); | 
| 2056 | 
> | 
              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(omega); | 
| 2057 | 
  | 
              break; | 
| 2058 | 
  | 
            case DENSITY: | 
| 2059 | 
  | 
              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(den); |