Example of usage

 

Point Lookup

    Here is an example of one way to determine a soil texture class based on a given particle-size distribution:

std::fstream fin("schemes/uk.dat"); // file with the UK scheme
tal::soiltex soil;                  // soiltex object
soil.LoadScheme(fin);               // load the scheme from file

if (soil.IsSchemeValid())           // make sure scheme is valid
{
   double dSand = 33.5;             // 33.5% sand
   double dClay = 23.5;             // 23.5% clay
   // lookup the UK texture class now;
   // the z-coordinate is unused by default
   std::vector<tal::TEXTURE> result = soil.PointLookup(dSand, dClay);
}

 

Range Lookup

    Here is an example of one way to determine all soil texture classes based on the given ranges of particle-size distribution:

std::fstream fin("schemes/uk.dat"); // file with the UK scheme
tal::soiltex soil;                  // soiltex object
soil.LoadScheme(fin);               // load the scheme from file

if (soil.IsSchemeValid())           // make sure scheme is valid
{
   tal::RANGE rgx(10, 70);          // 10 to 70% sand
   tal::RANGE rgy(30, 50);          // 30 to 50% clay
   // lookup the UK texture classes now;
   // z-coordinate range is 0 to 100% by default
   std::vector<tal::TEXTURE> result = soil.RangeLookup(rgx, rgy);
}

 

Result of Lookup

From the above two examples, the result container, returned after a Point or Range Lookup, can be indexed in the following manner:

// output every texture class code and name
for (int i=0; i<result.size(); ++i)
   std::cout << result[i].mCode << ", "
             << result[i].mName << std::endl;

 

 
 
TAL Home | Code Main Page | email
 
  updated: 02-Mar-2001