double PatchSideDataNormOpsComplex::RMSNorm( const boost::shared_ptr<pdat::SideData<dcomplex> >& data, const hier::Box& box, const boost::shared_ptr<pdat::SideData<double> >& cvol) const { TBOX_ASSERT(data); double retval = L2Norm(data, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { retval /= sqrt(sumControlVolumes(data, cvol, box)); } return retval; }
double PatchFaceDataNormOpsComplex::weightedRMSNorm( const std::shared_ptr<pdat::FaceData<dcomplex> >& data, const std::shared_ptr<pdat::FaceData<dcomplex> >& weight, const hier::Box& box, const std::shared_ptr<pdat::FaceData<double> >& cvol) const { TBOX_ASSERT(data && weight); double retval = weightedL2Norm(data, weight, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { retval /= sqrt(sumControlVolumes(data, cvol, box)); } return retval; }
int main(int argc, const char * argv[]) { long listSize; listSize = numberOfEntries(); //calculates size of list array /*in future we can implement some functions that will add new elements into list array like in ArrayList in Java, so then we do not need to calculate the size of the array :)*/ struct list items[listSize]; openFileAndAddToList(items, listSize); printf("Merging...\n"); // sorting(items, listSize); sorting(items,0 , listSize-1); writeToFile(items,listSize); printf("Done!\n"); printf("___________________________________________________________\n"); printf("All data written in \"all.log\" file at program root folder.\n"); printf("___________________________________________________________\n"); return 0; }
double PatchSideDataNormOpsReal<TYPE>::weightedRMSNorm( const boost::shared_ptr<pdat::SideData<TYPE> >& data, const boost::shared_ptr<pdat::SideData<TYPE> >& weight, const hier::Box& box, const boost::shared_ptr<pdat::SideData<double> >& cvol) const { TBOX_ASSERT(data && weight); TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval = weightedL2Norm(data, weight, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval /= sqrt(sumControlVolumes(data, cvol, box)); } return retval; }