Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

void Impala::Persistency::DistributedAccessRepositoryInFile::WriteFeatures ( DistributedAccess da,
const KernelMatrixLocator loc 
) [inline, private]

Definition at line 327 of file DistributedAccessRepositoryInFile.h.

References Impala::Core::Matrix::DistributedAccess::GetAverage(), GetDir(), Impala::Core::Matrix::DistributedAccess::GetFeature(), Impala::Persistency::KernelMatrixLocator::GetFeature(), Impala::Persistency::RepositoryInFileSystem::GetFile(), Impala::Core::Matrix::DistributedAccess::GetHasOwnAverages(), Impala::Core::Matrix::DistributedAccess::GetNrFeatures(), Impala::Core::Matrix::DistributedAccess::GetStartNode(), Impala::Core::Matrix::DistributedAccess::GetWeight(), Impala::Persistency::File::GetWriteBuffer(), ILOG_ERROR, Impala::MakeString(), Impala::Util::IOBuffer::Puts(), RepFS(), and Impala::Util::IOBuffer::Write().

Referenced by Add().

00328     {
00329         if (Link::Mpi::MyId() != da->GetStartNode())
00330             return;
00331 
00332         String dir = GetDir(loc);
00333         String filename = loc.GetFeature() + ".input.txt";
00334         File file = RepFS().GetFile(loc, dir, filename, true, false);
00335         Util::IOBuffer* buf = file.GetWriteBuffer();
00336         if (buf)
00337         {
00338             for (int i=0 ; i<da->GetNrFeatures() ; i++)
00339             {
00340                 String s = MakeString(da->GetWeight(i)) + " " +
00341                     da->GetFeature(i);
00342                 buf->Puts(s);
00343             }
00344             delete buf;
00345         }
00346         else
00347         {
00348             ILOG_ERROR("Could not write input.txt");
00349         }
00350 
00351         if (da->GetHasOwnAverages())
00352         {
00353             String filename = loc.GetFeature() + ".averages.raw";
00354             File file = RepFS().GetFile(loc, dir, filename, true, false);
00355             Util::IOBuffer* buf = file.GetWriteBuffer();
00356             if (buf)
00357             {
00358                 for (int i=0 ; i<da->GetNrFeatures() ; i++)
00359                 {
00360                     double val = da->GetAverage(i);
00361                     buf->Write(&val, sizeof(double));
00362                 }
00363                 delete buf;
00364             }
00365             else
00366             {
00367                 ILOG_ERROR("Could not write averages.raw");
00368             }
00369         }
00370     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:22:40 2011 for ImpalaSrc by  doxygen 1.5.1